Skip to content

Commit 992d6c1

Browse files
luiscapegvisor-bot
authored andcommitted
Adds missing video encoding NVIDIA ioctl classes
This adds missing NVJPG (JPEG encoding/decoding) and optical flow classes. Both are used in video-processing workflows, hence the video capability conditional. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12867 from luiscape:implement-missing-video-ioctls bf9b0ea PiperOrigin-RevId: 895636981
1 parent 50a14dc commit 992d6c1

2 files changed

Lines changed: 80 additions & 14 deletions

File tree

pkg/abi/nvgpu/classes.go

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,49 +82,58 @@ const (
8282
KEPLER_CHANNEL_GROUP_A = 0x0000a06c
8383
NVENC_SW_SESSION = 0x0000a0bc
8484
KEPLER_INLINE_TO_MEMORY_B = 0x0000a140
85+
NVB8B0_VIDEO_DECODER = 0x0000b8b0
86+
NVB8D1_VIDEO_NVJPG = 0x0000b8d1
87+
NVB8FA_VIDEO_OFA = 0x0000b8fa
8588
VOLTA_USERMODE_A = 0x0000c361
8689
TURING_USERMODE_A = 0x0000c461
8790
TURING_CHANNEL_GPFIFO_A = 0x0000c46f
88-
NVB8B0_VIDEO_DECODER = 0x0000b8b0 // Hopper
89-
NVC4B0_VIDEO_DECODER = 0x0000c4b0 // Turing
90-
NVC6B0_VIDEO_DECODER = 0x0000c6b0 // Ampere
91-
NVC7B0_VIDEO_DECODER = 0x0000c7b0 // Ampere
92-
NVC9B0_VIDEO_DECODER = 0x0000c9b0 // Ada
93-
NVCDB0_VIDEO_DECODER = 0x0000cdb0 // Blackwell
91+
NVC4B0_VIDEO_DECODER = 0x0000c4b0
9492
NVC4B7_VIDEO_ENCODER = 0x0000c4b7
95-
NVC7B7_VIDEO_ENCODER = 0x0000c7b7
96-
NVC9B7_VIDEO_ENCODER = 0x0000c9b7
97-
NVCEB7_VIDEO_ENCODER = 0x0000ceb7
98-
NVCFB7_VIDEO_ENCODER = 0x0000cfb7
99-
NVD1B7_VIDEO_ENCODER = 0x0000d1b7
93+
NVC4D1_VIDEO_NVJPG = 0x0000c4d1
10094
AMPERE_CHANNEL_GPFIFO_A = 0x0000c56f
10195
TURING_A = 0x0000c597
10296
TURING_DMA_COPY_A = 0x0000c5b5
10397
TURING_COMPUTE_A = 0x0000c5c0
10498
HOPPER_USERMODE_A = 0x0000c661
105-
BLACKWELL_USERMODE_A = 0x0000c761
10699
AMPERE_A = 0x0000c697
100+
NVC6B0_VIDEO_DECODER = 0x0000c6b0
107101
AMPERE_DMA_COPY_A = 0x0000c6b5
108102
AMPERE_COMPUTE_A = 0x0000c6c0
103+
NVC6FA_VIDEO_OFA = 0x0000c6fa
104+
BLACKWELL_USERMODE_A = 0x0000c761
105+
NVC7B0_VIDEO_DECODER = 0x0000c7b0
109106
AMPERE_DMA_COPY_B = 0x0000c7b5
107+
NVC7B7_VIDEO_ENCODER = 0x0000c7b7
110108
AMPERE_COMPUTE_B = 0x0000c7c0
109+
NVC7FA_VIDEO_OFA = 0x0000c7fa
111110
HOPPER_CHANNEL_GPFIFO_A = 0x0000c86f
112111
HOPPER_DMA_COPY_A = 0x0000c8b5
113112
BLACKWELL_CHANNEL_GPFIFO_A = 0x0000c96f
113+
ADA_A = 0x0000c997
114+
NVC9B0_VIDEO_DECODER = 0x0000c9b0
114115
BLACKWELL_DMA_COPY_A = 0x0000c9b5
116+
NVC9B7_VIDEO_ENCODER = 0x0000c9b7
117+
ADA_COMPUTE_A = 0x0000c9c0
118+
NVC9D1_VIDEO_NVJPG = 0x0000c9d1
119+
NVC9FA_VIDEO_OFA = 0x0000c9fa
115120
BLACKWELL_CHANNEL_GPFIFO_B = 0x0000ca6f
116121
BLACKWELL_DMA_COPY_B = 0x0000cab5
117-
ADA_A = 0x0000c997
118-
ADA_COMPUTE_A = 0x0000c9c0
119122
NV_CONFIDENTIAL_COMPUTE = 0x0000cb33
120123
HOPPER_A = 0x0000cb97
121124
HOPPER_SEC2_WORK_LAUNCH_A = 0x0000cba2
122125
HOPPER_COMPUTE_A = 0x0000cbc0
123126
BLACKWELL_INLINE_TO_MEMORY_A = 0x0000cd40
124127
BLACKWELL_A = 0x0000cd97
128+
NVCDB0_VIDEO_DECODER = 0x0000cdb0
125129
BLACKWELL_COMPUTE_A = 0x0000cdc0
130+
NVCDD1_VIDEO_NVJPG = 0x0000cdd1
131+
NVCDFA_VIDEO_OFA = 0x0000cdfa
126132
BLACKWELL_B = 0x0000ce97
133+
NVCEB7_VIDEO_ENCODER = 0x0000ceb7
127134
BLACKWELL_COMPUTE_B = 0x0000cec0
135+
NVCFB7_VIDEO_ENCODER = 0x0000cfb7
136+
NVD1B7_VIDEO_ENCODER = 0x0000d1b7
128137
)
129138

130139
// From src/common/sdk/nvidia/inc/class/cl0000.h:
@@ -721,3 +730,34 @@ type NVA0BC_ALLOC_PARAMETERS struct {
721730
Version uint32
722731
HMem Handle
723732
}
733+
734+
// NV_NVJPG_ALLOCATION_PARAMETERS is the alloc params type for
735+
// NVxxD1_VIDEO_NVJPG classes, from src/common/sdk/nvidia/inc/nvos.h.
736+
//
737+
// +marshal
738+
type NV_NVJPG_ALLOCATION_PARAMETERS struct {
739+
_ structs.HostLayout
740+
Size uint32
741+
ProhibitMultipleInstances uint32
742+
EngineInstance uint32
743+
}
744+
745+
// NV_OFA_ALLOCATION_PARAMETERS is the alloc params type for
746+
// NVxxFA_VIDEO_OFA classes, from src/common/sdk/nvidia/inc/nvos.h.
747+
//
748+
// +marshal
749+
type NV_OFA_ALLOCATION_PARAMETERS struct {
750+
_ structs.HostLayout
751+
Size uint32
752+
ProhibitMultipleInstances uint32
753+
}
754+
755+
// NV_OFA_ALLOCATION_PARAMETERS_V545 is the updated version of
756+
// NV_OFA_ALLOCATION_PARAMETERS since 545.23.06.
757+
//
758+
// +marshal
759+
type NV_OFA_ALLOCATION_PARAMETERS_V545 struct {
760+
_ structs.HostLayout
761+
NV_OFA_ALLOCATION_PARAMETERS
762+
EngineInstance uint32
763+
}

pkg/sentry/devices/nvproxy/version.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,13 @@ func Init() {
419419
nvgpu.NVC4B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
420420
nvgpu.NVC7B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
421421
nvgpu.NVC9B7_VIDEO_ENCODER: allocHandler(rmAllocSimple[nvgpu.NV_MSENC_ALLOCATION_PARAMETERS], nvconf.CapVideo),
422+
nvgpu.NVB8D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
423+
nvgpu.NVC4D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
424+
nvgpu.NVC9D1_VIDEO_NVJPG: allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo),
425+
nvgpu.NVB8FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
426+
nvgpu.NVC6FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
427+
nvgpu.NVC7FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
428+
nvgpu.NVC9FA_VIDEO_OFA: allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo),
422429
nvgpu.AMPERE_CHANNEL_GPFIFO_A: allocHandler(rmAllocChannel, compUtil),
423430
nvgpu.HOPPER_CHANNEL_GPFIFO_A: allocHandler(rmAllocChannel, compUtil),
424431
nvgpu.TURING_A: allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics),
@@ -699,6 +706,13 @@ func Init() {
699706
nvgpu.NVC4B7_VIDEO_ENCODER: ioctlInfo("NVC4B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
700707
nvgpu.NVC7B7_VIDEO_ENCODER: ioctlInfo("NVC7B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
701708
nvgpu.NVC9B7_VIDEO_ENCODER: ioctlInfo("NVC9B7_VIDEO_ENCODER", nvgpu.NV_MSENC_ALLOCATION_PARAMETERS{}),
709+
nvgpu.NVB8D1_VIDEO_NVJPG: ioctlInfo("NVB8D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
710+
nvgpu.NVC4D1_VIDEO_NVJPG: ioctlInfo("NVC4D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
711+
nvgpu.NVC9D1_VIDEO_NVJPG: ioctlInfo("NVC9D1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{}),
712+
nvgpu.NVB8FA_VIDEO_OFA: ioctlInfo("NVB8FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
713+
nvgpu.NVC6FA_VIDEO_OFA: ioctlInfo("NVC6FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
714+
nvgpu.NVC7FA_VIDEO_OFA: ioctlInfo("NVC7FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
715+
nvgpu.NVC9FA_VIDEO_OFA: ioctlInfo("NVC9FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{}),
702716
nvgpu.AMPERE_CHANNEL_GPFIFO_A: ioctlInfo("AMPERE_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{}),
703717
nvgpu.HOPPER_CHANNEL_GPFIFO_A: ioctlInfo("HOPPER_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{}),
704718
nvgpu.TURING_A: ioctlInfo("TURING_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{}),
@@ -751,6 +765,10 @@ func Init() {
751765
abi.allocationClass[nvgpu.NV01_MEMORY_SYSTEM] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
752766
abi.allocationClass[nvgpu.NV01_MEMORY_LOCAL_USER] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
753767
abi.allocationClass[nvgpu.NV50_MEMORY_VIRTUAL] = allocHandler(rmAllocSimple[nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545], compUtil)
768+
abi.allocationClass[nvgpu.NVB8FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
769+
abi.allocationClass[nvgpu.NVC6FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
770+
abi.allocationClass[nvgpu.NVC7FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
771+
abi.allocationClass[nvgpu.NVC9FA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
754772

755773
prevGetInfo := abi.getInfo
756774
abi.getInfo = func() *DriverABIInfo {
@@ -764,6 +782,10 @@ func Init() {
764782
info.AllocationInfos[nvgpu.NV01_MEMORY_SYSTEM] = ioctlInfoWithStructName("NV01_MEMORY_SYSTEM", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
765783
info.AllocationInfos[nvgpu.NV01_MEMORY_LOCAL_USER] = ioctlInfoWithStructName("NV01_MEMORY_LOCAL_USER", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
766784
info.AllocationInfos[nvgpu.NV50_MEMORY_VIRTUAL] = ioctlInfoWithStructName("NV50_MEMORY_VIRTUAL", nvgpu.NV_MEMORY_ALLOCATION_PARAMS_V545{}, "NV_MEMORY_ALLOCATION_PARAMS")
785+
info.AllocationInfos[nvgpu.NVB8FA_VIDEO_OFA] = ioctlInfoWithStructName("NVB8FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
786+
info.AllocationInfos[nvgpu.NVC6FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC6FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
787+
info.AllocationInfos[nvgpu.NVC7FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC7FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
788+
info.AllocationInfos[nvgpu.NVC9FA_VIDEO_OFA] = ioctlInfoWithStructName("NVC9FA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
767789
return info
768790
}
769791

@@ -875,6 +897,8 @@ func Init() {
875897
v560_28_03 := func() *driverABI {
876898
abi := v555_42_02()
877899
abi.allocationClass[nvgpu.NVCDB0_VIDEO_DECODER] = allocHandler(rmAllocSimple[nvgpu.NV_BSP_ALLOCATION_PARAMETERS], nvconf.CapVideo)
900+
abi.allocationClass[nvgpu.NVCDD1_VIDEO_NVJPG] = allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo)
901+
abi.allocationClass[nvgpu.NVCDFA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545], nvconf.CapVideo)
878902
abi.allocationClass[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = allocHandler(rmAllocChannel, compUtil)
879903
abi.allocationClass[nvgpu.BLACKWELL_DMA_COPY_A] = allocHandler(rmAllocSimple[nvgpu.NVB0B5_ALLOCATION_PARAMETERS], compUtil)
880904
abi.allocationClass[nvgpu.BLACKWELL_A] = allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics)
@@ -887,6 +911,8 @@ func Init() {
887911
abi.getInfo = func() *DriverABIInfo {
888912
info := prevGetInfo()
889913
info.AllocationInfos[nvgpu.NVCDB0_VIDEO_DECODER] = ioctlInfo("NVCDB0_VIDEO_DECODER", nvgpu.NV_BSP_ALLOCATION_PARAMETERS{})
914+
info.AllocationInfos[nvgpu.NVCDD1_VIDEO_NVJPG] = ioctlInfo("NVCDD1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{})
915+
info.AllocationInfos[nvgpu.NVCDFA_VIDEO_OFA] = ioctlInfoWithStructName("NVCDFA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS_V545{}, "NV_OFA_ALLOCATION_PARAMETERS")
890916
info.AllocationInfos[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = ioctlInfo("BLACKWELL_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{})
891917
info.AllocationInfos[nvgpu.BLACKWELL_DMA_COPY_A] = ioctlInfo("BLACKWELL_DMA_COPY_A", nvgpu.NVB0B5_ALLOCATION_PARAMETERS{})
892918
info.AllocationInfos[nvgpu.BLACKWELL_A] = ioctlInfo("BLACKWELL_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{})

0 commit comments

Comments
 (0)