Skip to content

Commit 3d80528

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 defcad3 PiperOrigin-RevId: 895636933
1 parent 140f64c commit 3d80528

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

pkg/abi/nvgpu/classes.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ const (
9797
NVCEB7_VIDEO_ENCODER = 0x0000ceb7
9898
NVCFB7_VIDEO_ENCODER = 0x0000cfb7
9999
NVD1B7_VIDEO_ENCODER = 0x0000d1b7
100+
NVB8D1_VIDEO_NVJPG = 0x0000b8d1 // Hopper
101+
NVC4D1_VIDEO_NVJPG = 0x0000c4d1 // Turing
102+
NVC9D1_VIDEO_NVJPG = 0x0000c9d1 // Ada
103+
NVCDD1_VIDEO_NVJPG = 0x0000cdd1 // Blackwell
104+
NVB8FA_VIDEO_OFA = 0x0000b8fa // Hopper
105+
NVC6FA_VIDEO_OFA = 0x0000c6fa // Ampere
106+
NVC7FA_VIDEO_OFA = 0x0000c7fa // Ampere
107+
NVC9FA_VIDEO_OFA = 0x0000c9fa // Ada
108+
NVCDFA_VIDEO_OFA = 0x0000cdfa // Blackwell
100109
AMPERE_CHANNEL_GPFIFO_A = 0x0000c56f
101110
TURING_A = 0x0000c597
102111
TURING_DMA_COPY_A = 0x0000c5b5
@@ -721,3 +730,25 @@ 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+
EngineInstance uint32
754+
}

pkg/sentry/devices/nvproxy/version.go

Lines changed: 18 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{}),
@@ -876,6 +890,8 @@ func Init() {
876890
v560_28_03 := func() *driverABI {
877891
abi := v555_42_02()
878892
abi.allocationClass[nvgpu.NVCDB0_VIDEO_DECODER] = allocHandler(rmAllocSimple[nvgpu.NV_BSP_ALLOCATION_PARAMETERS], nvconf.CapVideo)
893+
abi.allocationClass[nvgpu.NVCDD1_VIDEO_NVJPG] = allocHandler(rmAllocSimple[nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS], nvconf.CapVideo)
894+
abi.allocationClass[nvgpu.NVCDFA_VIDEO_OFA] = allocHandler(rmAllocSimple[nvgpu.NV_OFA_ALLOCATION_PARAMETERS], nvconf.CapVideo)
879895
abi.allocationClass[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = allocHandler(rmAllocChannel, compUtil)
880896
abi.allocationClass[nvgpu.BLACKWELL_DMA_COPY_A] = allocHandler(rmAllocSimple[nvgpu.NVB0B5_ALLOCATION_PARAMETERS], compUtil)
881897
abi.allocationClass[nvgpu.BLACKWELL_A] = allocHandler(rmAllocSimple[nvgpu.NV_GR_ALLOCATION_PARAMETERS], nvconf.CapGraphics)
@@ -888,6 +904,8 @@ func Init() {
888904
abi.getInfo = func() *DriverABIInfo {
889905
info := prevGetInfo()
890906
info.AllocationInfos[nvgpu.NVCDB0_VIDEO_DECODER] = ioctlInfo("NVCDB0_VIDEO_DECODER", nvgpu.NV_BSP_ALLOCATION_PARAMETERS{})
907+
info.AllocationInfos[nvgpu.NVCDD1_VIDEO_NVJPG] = ioctlInfo("NVCDD1_VIDEO_NVJPG", nvgpu.NV_NVJPG_ALLOCATION_PARAMETERS{})
908+
info.AllocationInfos[nvgpu.NVCDFA_VIDEO_OFA] = ioctlInfo("NVCDFA_VIDEO_OFA", nvgpu.NV_OFA_ALLOCATION_PARAMETERS{})
891909
info.AllocationInfos[nvgpu.BLACKWELL_CHANNEL_GPFIFO_A] = ioctlInfo("BLACKWELL_CHANNEL_GPFIFO_A", nvgpu.NV_CHANNEL_ALLOC_PARAMS{})
892910
info.AllocationInfos[nvgpu.BLACKWELL_DMA_COPY_A] = ioctlInfo("BLACKWELL_DMA_COPY_A", nvgpu.NVB0B5_ALLOCATION_PARAMETERS{})
893911
info.AllocationInfos[nvgpu.BLACKWELL_A] = ioctlInfo("BLACKWELL_A", nvgpu.NV_GR_ALLOCATION_PARAMETERS{})

0 commit comments

Comments
 (0)