media: iris: Add AR50LT core support and enable Agatti platform
Subsystems (5)
v5 cover media: iris: Add AR50LT core support and enable Agatti platform
This series adds support for the AR50Lt VPU core to the iris driver and enables the Agatti SoC to use Gen2 firmware and HFI.
AR50Lt introduces a few platform-specific requirements that need to be handled in the iris core and VPU abstraction layer. To accommodate this, the series adds minimal hooks and updates needed to allow the firmware to operate correctly on AR50Lt without impacting existing supported platforms.
Additionally, the series wires up Agatti to use the Gen2 firmware and HFI path, aligning it with newer generations of supported Qualcomm video hardware.
v4l2-compliance results:
v4l2-compliance -d /dev/video1 -s v4l2-compliance 1.33.0-5421, 64 bits, 64-bit time_t v4l2-compliance SHA: af4a91dea9a2 2025-10-29 10:33:25
Compliance test for iris_driver device /dev/video1:
Driver Info:
Driver name : iris_driver
Card type : Iris Encoder
Bus info : platform:5a00000.video-codec
Driver version : 6.19.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Encoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 43 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK
test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Test input 0:
Streaming ioctls:
test read/write: OK67609.731994] use of bytesused == 0 is deprecated and will be removed in the future, [67609.741833] use the actual size instead.
m (Not Supported)
Video Capture Multiplanar: Captured 61 buffers test MMAP (select, REQBUFS): OK
Video Capture Multiplanar: Captured 61 buffers test MMAP (epoll, REQBUFS): OK
Video Capture Multiplanar: Captured 61 buffers test MMAP (select, CREATE_BUFS): OK Video Capture Multiplanar: Captured 61 buffers test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device
Total for iris_driver device /dev/video1: 54, Succeeded: 54, Failed: 0, Warnings: 0
v4l2-compliance -d /dev/video0 -s5 --stream-from=/media/FVDO_Freeway_720p.264 v4l2-compliance 1.33.0-5421, 64 bits, 64-bit time_t v4l2-compliance SHA: af4a91dea9a2 2025-10-29 10:33:25
Compliance test for iris_driver device /dev/video0:
Driver Info:
Driver name : iris_driver
Card type : Iris Decoder
Bus info : platform:5a00000.video-codec
Driver version : 6.19.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Decoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 12 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK
test Composing: OK
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Test input 0:
Streaming ioctls:
test read/write: OK (Not Supported)
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (select, REQBUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (epoll, REQBUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (select, CREATE_BUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device
Total for iris_driver device /dev/video0: 54, Succeeded: 54, Failed: 0, Warnings: 0
Fluster results for HFI Gen2 firmware:
./fluster.py run -ts JVT-AVC_V1 -d GStreamer-H.264-V4L2-Gst1.0 - 77/135
The failing test case:
- Unsupported profile: H.264 Extended profile is deprecated.
- BA3_SVA_C
- Interlaced content is not supported yet.
- CABREF3_Sand_D
- CAFI1_SVA_C
- CAMA1_Sony_C
- CAMA1_TOSHIBA_B
- CAMA3_Sand_E
- CAMACI3_Sony_C
- CAMANL1_TOSHIBA_B
- CAMANL2_TOSHIBA_B
- CAMANL3_Sand_E
- CAMASL3_Sony_B
- CAMP_MOT_MBAFF_L30
- CAMP_MOT_MBAFF_L31
- CANLMA2_Sony_C
- CANLMA3_Sony_C
- CAPA1_TOSHIBA_B
- CAPAMA3_Sand_F
- CVCANLMA2_Sony_C
- CVFI1_SVA_C
- CVFI1_Sony_D
- CVFI2_SVA_C
- CVFI2_Sony_H
- CVMA1_Sony_D
- CVMA1_TOSHIBA_B
- CVMANL1_TOSHIBA_B
- CVMANL2_TOSHIBA_B
- CVMAPAQP3_Sony_E
- CVMAQP2_Sony_G
- CVMAQP3_Sony_D
- CVMP_MOT_FLD_L30_B
- CVMP_MOT_FRM_L31
- CVNLFI1_Sony_C
- CVNLFI2_Sony_H
- CVPA1_TOSHIBA_B
- FI1_Sony_E
- MR6_BT_B
- MR7_BT_B
- MR8_BT_B
- MR9_BT_B
- Sharp_MP_Field_1_B
- Sharp_MP_Field_2_B
- Sharp_MP_Field_3_B
- Sharp_MP_PAFF_1r2
- Sharp_MP_PAFF_2r
- cabac_mot_fld0_full
- cabac_mot_mbaff0_full
- cabac_mot_picaff0_full
- cama1_vtc_c
- cama2_vtc_b
- cama3_vtc_b
- cavlc_mot_fld0_full_B
- cavlc_mot_mbaff0_full_B
- cavlc_mot_picaff0_full_B
- Unsupported bitstream: num_slice_group_minus1 > 0 (slice groups not supported by hardware).
- FM1_BT_B
- FM1_FT_E
- FM2_SVA_C
- Unsupported bitstream: SP slice type is not supported by hardware.
- SP1_BT_A
- sp2_bt_b
./fluster.py run -ts JCT-VC-HEVC_V1 -d GStreamer-H.265-V4L2-Gst1.0 - 113/147 The failing test case:
- Unsupported level
- AMP_D_Hisilicon_3
- AMP_E_Hisilicon_3
- AMP_F_Hisilicon_3
- DELTAQP_A_BRCM_4
- IPRED_A_docomo_2
- IPRED_C_Mitsubishi_3
- LS_A_Orange_2
- LS_B_Orange_4
- PPS_A_qualcomm_7
- RAP_B_Bossen_2
- RPS_F_docomo_2
- SAO_G_Canon_3
- SDH_A_Orange_4
- 10bit content not supported yet
- DBLK_A_MAIN10_VIXS_4
- INITQP_B_Main10_Sony_1
- TSUNEQBD_A_MAIN10_Technicolor_2
- WPP_A_ericsson_MAIN10_2
- WPP_B_ericsson_MAIN10_2
- WPP_C_ericsson_MAIN10_2
- WPP_D_ericsson_MAIN10_2
- WPP_E_ericsson_MAIN10_2
- WPP_F_ericsson_MAIN10_2
- WP_A_MAIN10_Toshiba_3
- WP_MAIN10_B_Toshiba_3
- Unsupported resolution
- AMP_A_Samsung_7 - resolution is higher than max supported
- AMP_B_Samsung_7 - resolution is higher than max supported
- PICSIZE_A_Bossen_1 - resolution is higher than max supported
- PICSIZE_B_Bossen_1 - resolution is higher than max supported
- PICSIZE_C_Bossen_1 - resolution is higher than max supported
- PICSIZE_D_Bossen_1 - resolution is higher than max supported
- TUSIZE_A_Samsung_1 - resolution is higher than max supported
- WPP_D_ericsson_MAIN_2 - resolution is lower than min supported
- CRC mismatch
- RAP_A_docomo_6
- CRC mismatch - bitstream issue - fails with ffmpeg sw decoder as well
- VPSSPSPPS_A_MainConcept_1
./fluster.py run -ts VP9-TEST-VECTORS -d GStreamer-VP9-V4L2-Gst1.0 -j1 - 206/305 The failing test case:
- Unsupported resolution
- vp90-2-02-size-08x08.webm
- vp90-2-02-size-08x10.webm
- vp90-2-02-size-08x16.webm
- vp90-2-02-size-08x18.webm
- vp90-2-02-size-08x32.webm
- vp90-2-02-size-08x34.webm
- vp90-2-02-size-08x64.webm
- vp90-2-02-size-08x66.webm
- vp90-2-02-size-10x08.webm
- vp90-2-02-size-10x10.webm
- vp90-2-02-size-10x16.webm
- vp90-2-02-size-10x18.webm
- vp90-2-02-size-10x32.webm
- vp90-2-02-size-10x34.webm
- vp90-2-02-size-10x64.webm
- vp90-2-02-size-10x66.webm
- vp90-2-02-size-16x08.webm
- vp90-2-02-size-16x10.webm
- vp90-2-02-size-16x16.webm
- vp90-2-02-size-16x18.webm
- vp90-2-02-size-16x32.webm
- vp90-2-02-size-16x34.webm
- vp90-2-02-size-16x64.webm
- vp90-2-02-size-16x66.webm
- vp90-2-02-size-18x08.webm
- vp90-2-02-size-18x10.webm
- vp90-2-02-size-18x16.webm
- vp90-2-02-size-18x18.webm
- vp90-2-02-size-18x32.webm
- vp90-2-02-size-18x34.webm
- vp90-2-02-size-18x64.webm
- vp90-2-02-size-18x66.webm
- vp90-2-02-size-32x08.webm
- vp90-2-02-size-32x10.webm
- vp90-2-02-size-32x16.webm
- vp90-2-02-size-32x18.webm
- vp90-2-02-size-32x32.webm
- vp90-2-02-size-32x34.webm
- vp90-2-02-size-32x64.webm
- vp90-2-02-size-32x66.webm
- vp90-2-02-size-34x08.webm
- vp90-2-02-size-34x10.webm
- vp90-2-02-size-34x16.webm
- vp90-2-02-size-34x18.webm
- vp90-2-02-size-34x32.webm
- vp90-2-02-size-34x34.webm
- vp90-2-02-size-34x64.webm
- vp90-2-02-size-34x66.webm
- vp90-2-02-size-64x08.webm
- vp90-2-02-size-64x10.webm
- vp90-2-02-size-64x16.webm
- vp90-2-02-size-64x18.webm
- vp90-2-02-size-64x32.webm
- vp90-2-02-size-64x34.webm
- vp90-2-02-size-64x64.webm
- vp90-2-02-size-64x66.webm
- vp90-2-02-size-66x08.webm
- vp90-2-02-size-66x10.webm
- vp90-2-02-size-66x16.webm
- vp90-2-02-size-66x18.webm
- vp90-2-02-size-66x32.webm
- vp90-2-02-size-66x34.webm
- vp90-2-02-size-66x64.webm
- vp90-2-02-size-66x66.webm
- vp90-2-08-tile_1x8.webm - resolution is higher than max supported
- vp90-2-08-tile_1x8_frame_parallel.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-1-8.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-2-8.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-4-8.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-8-1.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-8-2.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm - resolution is higher than max supported
- vp90-2-14-resize-10frames-fp-tiles-8-4.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-1-16.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-1-8.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-16-1.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-16-2.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-16-4.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-16-8.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-2-16.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-2-8.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-4-16.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-4-8.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-8-1.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-8-16.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-8-2.webm - resolution is higher than max supported
- vp90-2-14-resize-fp-tiles-8-4.webm - resolution is higher than max supported
- Unsupported format
- vp91-2-04-yuv422.webm
- vp91-2-04-yuv444.webm
- CRC mismatch
- vp90-2-22-svc_1280x720_3.ivf
- Unsupported resolution after sequence change
- vp90-2-18-resize.ivf
- vp90-2-21-resize_inter_320x180_5_1-2.webm
- vp90-2-21-resize_inter_320x180_7_1-2.webm
- vp90-2-21-resize_inter_320x240_5_1-2.webm
- p90-2-21-resize_inter_320x240_7_1-2.webm
- Unsupported stream
- vp90-2-16-intra-only.webm
Fluster results for HFI Gen1 firmware:
Tests failing with the Venus driver, but passing with the Iris:
- H.264: BA3_SVA_C
- H.265: ipcm_A_NEC_3, ipcm_B_NEC_3, ipcm_C_NEC_3, ipcm_D_NEC_3, ipcm_E_NEC_2, IPRED_B_Nokia_3, VPSSPSPPS_A_MainConcept_1
- VP9: vp90-2-14-resize-10frames-fp-tiles-1-2.webm, vp90-2-14-resize-10frames-fp-tiles-2-1.webm, vp90-2-14-resize-fp-tiles-1-2.webm, vp90-2-14-resize-fp-tiles-2-1.webm, vp90-2-14-resize-fp-tiles-4-1.webm, vp90-2-14-resize-fp-tiles-4-2.webm, vp90-2-15-segkey.webm
Tests failing with the Iris driver, but passing with the Venus (due to interlaced H.264 being not supported yet):
- H.264: cabac_mot_fld0_full, cabac_mot_mbaff0_full, cabac_mot_picaff0_full, CABREF3_Sand_D, CAFI1_SVA_C, CAMA1_Sony_C, CAMA1_TOSHIBA_B, cama1_vtc_c, cama2_vtc_b, CAMA3_Sand_E, cama3_vtc_b, CAMACI3_Sony_C, CAMANL1_TOSHIBA_B, CAMANL2_TOSHIBA_B, CAMANL3_Sand_E, CAMASL3_Sony_B, CAMP_MOT_MBAFF_L30, CAMP_MOT_MBAFF_L31, CANLMA2_Sony_C, CANLMA3_Sony_C, CAPA1_TOSHIBA_B, CAPAMA3_Sand_F, cavlc_mot_fld0_full_B, cavlc_mot_mbaff0_full_B, cavlc_mot_picaff0_full_B, CVCANLMA2_Sony_C, CVFI1_Sony_D, CVFI1_SVA_C, CVFI2_Sony_H, CVFI2_SVA_C, CVMA1_Sony_D, CVMA1_TOSHIBA_B, CVMANL1_TOSHIBA_B, CVMANL2_TOSHIBA_B, CVMAPAQP3_Sony_E, CVMAQP2_Sony_G, CVMAQP3_Sony_D, CVMP_MOT_FLD_L30_B, CVMP_MOT_FRM_L31_B, CVNLFI1_Sony_C, CVNLFI2_Sony_H, CVPA1_TOSHIBA_B, FI1_Sony_E, MR9_BT_B, Sharp_MP_Field_1_B, Sharp_MP_Field_2_B, Sharp_MP_Field_3_B, Sharp_MP_PAFF_1r2, Sharp_MP_PAFF_2r
---
Changes in v5:
- Corrected UBWC formats handling for non-UBWC targets (Sashiko)
- Added missing data to x1p42100 data structures (Sashiko)
- Fixed bw calculations to use actual FPS, switched to common iris_vpu2_calculate_frequency() (Sashiko, Vishnu)
- Added comment regarding hold_count vs min_count (Sashiko)
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- Rebaed on linux-next, fixing conflicts. Note, these patches require
both media/fixes and media/next and thus can be applied only after
7.2-rc1.
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Corrected dependencies list in the cover letter
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Dropped OPP patch, applied by Bjorn.
- Dropped extra check for throttle clocks (Vishnu)
- Made iris_inst_fw_cap_gen1_ar50lt_dec and inst_fw_cap_sm8250_dec const (Vishnu)
- Renamed iris_vpu_ar50lt_buf_size() to iris_vpu_ar50lt_gen2_buf_size() (Vishnu)
- Link to v1: https://patch.msgid.link/[email protected]
To: Vikash Garodia <[email protected]>
To: Dikshita Agarwal <[email protected]>
To: Abhinav Kumar <[email protected]>
To: Bryan O'Donoghue <[email protected]>
To: Mauro Carvalho Chehab <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Dikshita Agarwal (10):
media: iris: Skip UBWC configuration when not supported
media: iris: Filter UBWC raw formats based on hardware capabilities
media: iris: Introduce set_preset_register as a vpu_op
media: iris: Introduce interrupt_init as a vpu_op
media: iris: add vpu op hook to disable ARP buffer
media: iris: Add platform data field for watchdog interrupt mask
media: iris: Add platform flag for instantaneous bandwidth voting
media: iris: Add framework support for AR50_LITE video core
media: iris: Introduce buffer size calculations for AR50LT
media: iris: add Gen2 firmware support on the Agatti platform
Dmitry Baryshkov (6):
media: iris: skip PIPE if it is not supported by the platform
media: iris: add minimal GET_PROPERTY implementation
media: iris: update buffer requirements based on received info
media: iris: implement support for the Agatti platform
media: venus: skip QCM2290 if Iris driver is enabled
media: iris: constify inst_fw_cap_sm8250_dec
drivers/media/platform/qcom/iris/Makefile | 2 + drivers/media/platform/qcom/iris/iris_core.c | 4 + drivers/media/platform/qcom/iris/iris_ctrls.c | 3 + drivers/media/platform/qcom/iris/iris_hfi_common.c | 4 + drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 229 +++++++- .../platform/qcom/iris/iris_hfi_gen1_command.c | 21 + .../platform/qcom/iris/iris_hfi_gen1_defines.h | 15 + .../platform/qcom/iris/iris_hfi_gen1_response.c | 79 +++ drivers/media/platform/qcom/iris/iris_hfi_gen2.c | 613 +++++++++++++++++++++ .../platform/qcom/iris/iris_hfi_gen2_packet.c | 3 + .../platform/qcom/iris/iris_platform_common.h | 11 + .../media/platform/qcom/iris/iris_platform_vpu2.c | 6 + .../media/platform/qcom/iris/iris_platform_vpu3x.c | 12 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 117 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_resources.c | 2 + drivers/media/platform/qcom/iris/iris_vdec.c | 26 +- drivers/media/platform/qcom/iris/iris_venc.c | 9 + drivers/media/platform/qcom/iris/iris_vpu2.c | 30 +- drivers/media/platform/qcom/iris/iris_vpu3x.c | 6 + drivers/media/platform/qcom/iris/iris_vpu4x.c | 2 + drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c | 130 +++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 414 ++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 38 ++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 43 +- drivers/media/platform/qcom/iris/iris_vpu_common.h | 6 + .../platform/qcom/iris/iris_vpu_register_defines.h | 1 - drivers/media/platform/qcom/venus/core.c | 4 +- 29 files changed, 1794 insertions(+), 41 deletions(-)
---
base-commit: 8d6dbbbe3ba62de0a63e962ee004afb848c8e3ac
change-id: 20260507-iris-ar50lt-06228469aa5b
prerequisite-change-id: 20260429-kodiak-gen2-support-v4-a7f055f15afb:v7
prerequisite-patch-id: 9cbeeeda00ce3c8ac611ded245740153cd54f899
Best regards,
Signature · 2 lines
With best wishes Dmitry
PATCH v5 1/16 media: iris: Skip UBWC configuration when not supported
From: Dikshita Agarwal <[email protected]>
UBWC configuration is not applicable to all SoCs. Add a check to avoid configuring UBWC during sys init on unsupported platforms.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +3 -0
@@ -140,6 +140,9 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); +if (!ubwc->ubwc_enc_version) +return ; + payload =qcom_ubwc_macrotile_mode (ubwc) ?8 :4 ; iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_MAX_CHANNELS,
Signature · 1 line
2.47.3
PATCH v5 2/16 media: iris: Filter UBWC raw formats based on hardware capabilities
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
The raw formats supported by Iris were previously advertised unconditionally, assuming UBWC support on all platforms. However, some platforms do not support UBWC which results in incorrect format capability exposure.
Use the UBWC configuration provided by the platform to dynamically filter raw formats at runtime. If UBWC is not supported, UBWC-based formats are omitted from the advertised capability list, while linear formats remain available.
--- drivers/media/platform/qcom/iris/iris_vdec.c | 26 ++++++++++++++++++++++---- drivers/media/platform/qcom/iris/iris_venc.c | 9 +++++++++ 2 files changed, 31 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_vdec.c +22 -4
@@ -3,6 +3,7 @@* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ +#include <linux/soc/qcom/ubwc.h> #include <media/v4l2-event.h> #include <media/v4l2-mem2mem.h>
@@ -69,8 +70,14 @@ static const u32 iris_vdec_formats_cap[] = { [IRIS_FMT_QC10C] = V4L2_PIX_FMT_QC10C, }; +static const u32 iris_vdec_formats_noubwc_cap[] = { + [IRIS_FMT_NV12 ] =V4L2_PIX_FMT_NV12 , + [IRIS_FMT_TP10 ] =V4L2_PIX_FMT_P010 , +}; +static bool check_format (struct iris_inst *inst,u32 pixfmt,u32 type) { +const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;unsigned int size, i;const u32 *fmt;
@@ -80,8 +87,13 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type) size = inst->core->iris_platform_data->inst_iris_fmts_size;break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : - fmt = iris_vdec_formats_cap; - size =ARRAY_SIZE (iris_vdec_formats_cap); +if (ubwc->ubwc_enc_version) { + fmt = iris_vdec_formats_cap; + size =ARRAY_SIZE (iris_vdec_formats_cap); + }else { + fmt = iris_vdec_formats_noubwc_cap; + size =ARRAY_SIZE (iris_vdec_formats_noubwc_cap); + }break ;default :return false;
@@ -110,6 +122,7 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)static u32 find_format_by_index (struct iris_inst *inst,u32 index,u32 type) { +const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;unsigned int size;const u32 *fmt;
@@ -119,8 +132,13 @@ static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type) size = inst->core->iris_platform_data->inst_iris_fmts_size;break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : - fmt = iris_vdec_formats_cap; - size =ARRAY_SIZE (iris_vdec_formats_cap); +if (ubwc->ubwc_enc_version) { + fmt = iris_vdec_formats_cap; + size =ARRAY_SIZE (iris_vdec_formats_cap); + }else { + fmt = iris_vdec_formats_noubwc_cap; + size =ARRAY_SIZE (iris_vdec_formats_noubwc_cap); + }break ;default :return 0 ;
drivers/media/platform/qcom/iris/iris_venc.c +9 -0
@@ -3,6 +3,7 @@* Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ +#include <linux/soc/qcom/ubwc.h> #include <media/v4l2-event.h> #include <media/v4l2-mem2mem.h>
@@ -91,6 +92,7 @@ static const u32 iris_venc_formats_out[] = {static bool check_format (struct iris_inst *inst,u32 pixfmt,u32 type) { +const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;unsigned int size, i;const u32 *fmt;
@@ -98,6 +100,9 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : fmt = iris_venc_formats_out; size =ARRAY_SIZE (iris_venc_formats_out); +/* Last format is UBWC; drop it if UBWC is unsupported */ +if (!ubwc->ubwc_enc_version) + size--;break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : fmt = iris_venc_formats_cap;
@@ -117,6 +122,7 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)static u32 find_format_by_index (struct iris_inst *inst,u32 index,u32 type) { +const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;unsigned int size;const u32 *fmt;
@@ -124,6 +130,9 @@ static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type)case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : fmt = iris_venc_formats_out; size =ARRAY_SIZE (iris_venc_formats_out); +/* Last format is UBWC; drop it if UBWC is unsupported */ +if (!ubwc->ubwc_enc_version) + size--;break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : fmt = iris_venc_formats_cap;
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 02/16] media: iris: Filter UBWC raw formats based on hardware capabilities
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The `iris_vdec_formats_noubwc_cap` array contains a zero-initialized gap at index 1, which…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The iris_vdec_formats_noubwc_cap array contains a zero-initialized gap at index 1, which prematurely terminates V4L2 format enumeration and improperly validates 0 as a valid pixel format. --
commit 1ff6b6e464175bc1ccf6878e0aa89ffec126608b
Author: Dikshita Agarwal <[email protected]>
media: iris: Filter UBWC raw formats based on hardware capabilities
The raw formats supported by Iris were previously advertised unconditionally, assuming UBWC support on all platforms. Use the UBWC configuration provided by the platform to dynamically filter raw formats at runtime, keeping linear formats available when UBWC is not supported.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_vdec.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_vdec.c static const u32 iris_vdec_formats_cap[] = { · line 76
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vdec.c +4
-0@@ -69,8 +70,14 @@ static const u32 iris_vdec_formats_cap[] = { [IRIS_FMT_QC10C] = V4L2_PIX_FMT_QC10C, }; +static const u32 iris_vdec_formats_noubwc_cap[] = { + [IRIS_FMT_NV12 ] =V4L2_PIX_FMT_NV12 , + [IRIS_FMT_TP10 ] =V4L2_PIX_FMT_P010 , +};
[Severity: High]
Does this create a sparse array with a zero-initialized gap at index 1?
Because IRIS_FMT_NV12 is 0 and IRIS_FMT_TP10 is 2, skipping index 1 (IRIS_FMT_QC08C) implicitly initializes it to 0.
When check_format() in iris_vdec.c iterates through this array:
for (i = 0; i < size; i++) {
if (fmt[i] == pixfmt)
break;
}Won't it incorrectly accept 0 as a valid pixel format by matching against the uninitialized gap?
[ ... ]
Quoted 14 lines
drivers/media/platform/qcom/iris/iris_vdec.c +1
-2@@ -110,6 +122,7 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)static u32 find_format_by_index (struct iris_inst *inst,u32 index,u32 type) { +const struct qcom_ubwc_cfg_data *ubwc = inst->core->ubwc_cfg;unsigned int size;const u32 *fmt;@@ -119,8 +132,13 @@ static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type) size = inst->core->iris_platform_data->inst_iris_fmts_size;break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : - fmt = iris_vdec_formats_cap; - size =ARRAY_SIZE (iris_vdec_formats_cap);
drivers/media/platform/qcom/iris/iris_vdec.c static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 type) · line 144
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vdec.c +7
-0+if (ubwc->ubwc_enc_version) { + fmt = iris_vdec_formats_cap; + size =ARRAY_SIZE (iris_vdec_formats_cap); + }else { + fmt = iris_vdec_formats_noubwc_cap; + size =ARRAY_SIZE (iris_vdec_formats_noubwc_cap); + }break ;default :return 0 ;
[Severity: High]
Will the V4L2 enumeration stop prematurely when encountering the gap?
Since the V4L2 framework queries formats using a sequential index, querying index 1 will hit the zero-initialized hole, causing find_format_by_index() in iris_vdec.c to return 0.
When 0 is returned, V4L2 typically stops enumeration, meaning the valid 10-bit linear format (V4L2_PIX_FMT_P010) at index 2 will be completely hidden.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v5 02/16] media: iris: Filter UBWC raw formats based on hardware capabilities
Quoted 2 lines · On Tue, Jun 16, 2026 at 12:17:32AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Theiris_vdec_formats_noubwc_caparray contains a zero-initialized gap at index 1, which prematurely terminates V4L2 format enumeration and improperly validates 0 as a valid pixel format.
I will check later and respond or fix the issues.
Quoted 5 lines
--
commit
1ff6b6e464175bc1ccf6878e0aa89ffec126608b
Author: Dikshita Agarwal <[email protected]>
Signature · 2 lines
With best wishes Dmitry
PATCH v5 3/16 media: iris: Introduce set_preset_register as a vpu_op
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
The set_preset_registers sequence is currently shared across all supported devices. Starting with Qualcomm QCM2290 (AR50LT), the register programming would differ.
Move set_preset_register into a vpu_op to allow per-device customization.
This change prepares the driver for upcoming hardware variants. No functional change so far for existing devices.
--- drivers/media/platform/qcom/iris/iris_vpu2.c | 1 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 3 +++ drivers/media/platform/qcom/iris/iris_vpu4x.c | 1 + drivers/media/platform/qcom/iris/iris_vpu_common.c | 2 +- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + 5 files changed, 7 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vpu2.c +1 -0
@@ -45,4 +45,5 @@ const struct vpu_ops iris_vpu2_ops = { .power_on_controller = iris_vpu_power_on_controller, .calc_freq = iris_vpu2_calc_freq, .set_hwmode = iris_vpu_set_hwmode, + .set_preset_registers = iris_vpu_set_preset_registers, };
drivers/media/platform/qcom/iris/iris_vpu3x.c +3 -0
@@ -261,6 +261,7 @@ const struct vpu_ops iris_vpu3_ops = { .power_on_controller = iris_vpu_power_on_controller, .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, + .set_preset_registers = iris_vpu_set_preset_registers, };const struct vpu_ops iris_vpu33_ops = {
@@ -270,6 +271,7 @@ const struct vpu_ops iris_vpu33_ops = { .power_on_controller = iris_vpu_power_on_controller, .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, + .set_preset_registers = iris_vpu_set_preset_registers, };const struct vpu_ops iris_vpu35_ops = {
@@ -280,4 +282,5 @@ const struct vpu_ops iris_vpu35_ops = { .program_bootup_registers = iris_vpu35_vpu4x_program_bootup_registers, .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, + .set_preset_registers = iris_vpu_set_preset_registers, };
drivers/media/platform/qcom/iris/iris_vpu4x.c +1 -0
@@ -368,4 +368,5 @@ const struct vpu_ops iris_vpu4x_ops = { .program_bootup_registers = iris_vpu35_vpu4x_program_bootup_registers, .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu4x_set_hwmode, + .set_preset_registers = iris_vpu_set_preset_registers, };
drivers/media/platform/qcom/iris/iris_vpu_common.c +1 -1
@@ -483,7 +483,7 @@ int iris_vpu_power_on(struct iris_core *core)iris_opp_set_rate (core->dev, freq); -iris_vpu_set_preset_registers (core); + core->iris_platform_data->vpu_ops->set_preset_registers (core);iris_vpu_interrupt_init (core); core->intr_status =0 ;
drivers/media/platform/qcom/iris/iris_vpu_common.h +1 -0
@@ -22,6 +22,7 @@ struct vpu_ops {void (*program_bootup_registers)(struct iris_core *core);u64 (*calc_freq)(struct iris_inst *inst,size_t data_size);int (*set_hwmode)(struct iris_core *core); +void (*set_preset_registers)(struct iris_core *core); };int iris_vpu_boot_firmware (struct iris_core *core);
Signature · 1 line
2.47.3
PATCH v5 4/16 media: iris: Introduce interrupt_init as a vpu_op
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
The interrupt_init sequence is currently shared across all supported devices. Starting with Qualcomm QCM2290 (AR50LT), the register programming would differ.
Move interrupt_init into a vpu_op to allow per-device customization.
This change prepares the driver for upcoming hardware variants. No functional change so far for existing devices.
--- drivers/media/platform/qcom/iris/iris_vpu2.c | 1 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 3 +++ drivers/media/platform/qcom/iris/iris_vpu4x.c | 1 + drivers/media/platform/qcom/iris/iris_vpu_common.c | 4 ++-- drivers/media/platform/qcom/iris/iris_vpu_common.h | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_vpu2.c +1 -0
@@ -46,4 +46,5 @@ const struct vpu_ops iris_vpu2_ops = { .calc_freq = iris_vpu2_calc_freq, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, + .interrupt_init = iris_vpu_interrupt_init, };
drivers/media/platform/qcom/iris/iris_vpu3x.c +3 -0
@@ -262,6 +262,7 @@ const struct vpu_ops iris_vpu3_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, + .interrupt_init = iris_vpu_interrupt_init, };const struct vpu_ops iris_vpu33_ops = {
@@ -272,6 +273,7 @@ const struct vpu_ops iris_vpu33_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, + .interrupt_init = iris_vpu_interrupt_init, };const struct vpu_ops iris_vpu35_ops = {
@@ -283,4 +285,5 @@ const struct vpu_ops iris_vpu35_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, + .interrupt_init = iris_vpu_interrupt_init, };
drivers/media/platform/qcom/iris/iris_vpu4x.c +1 -0
@@ -369,4 +369,5 @@ const struct vpu_ops iris_vpu4x_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu4x_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, + .interrupt_init = iris_vpu_interrupt_init, };
drivers/media/platform/qcom/iris/iris_vpu_common.c +2 -2
@@ -31,7 +31,7 @@#define UC_REGION_ADDR (CPU_CS_BASE_OFFS + 0x64)#define UC_REGION_SIZE (CPU_CS_BASE_OFFS + 0x68) -static void iris_vpu_interrupt_init (struct iris_core *core) +void iris_vpu_interrupt_init (struct iris_core *core) {u32 mask_val;
@@ -485,7 +485,7 @@ int iris_vpu_power_on(struct iris_core *core) core->iris_platform_data->vpu_ops->set_preset_registers (core); -iris_vpu_interrupt_init (core); + core->iris_platform_data->vpu_ops->interrupt_init (core); core->intr_status =0 ;enable_irq (core->irq);
drivers/media/platform/qcom/iris/iris_vpu_common.h +2 -0
@@ -23,6 +23,7 @@ struct vpu_ops {u64 (*calc_freq)(struct iris_inst *inst,size_t data_size);int (*set_hwmode)(struct iris_core *core);void (*set_preset_registers)(struct iris_core *core); +void (*interrupt_init)(struct iris_core *core); };int iris_vpu_boot_firmware (struct iris_core *core);
@@ -44,5 +45,6 @@ void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core);u64 iris_vpu3x_vpu4x_calculate_frequency (struct iris_inst *inst,size_t data_size);void iris_vpu_set_preset_registers (struct iris_core *core); +void iris_vpu_interrupt_init (struct iris_core *core);#endif
Signature · 1 line
2.47.3
PATCH v5 5/16 media: iris: add vpu op hook to disable ARP buffer
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
On AR50LT platforms AbsolutelyPerfectRouting (ARP) needs to be disabled so firmware can configure the ARP internal buffer as non-secure for encoder usage. In preparation of adding support for AR50LT platforms, add an optional disable_arp callback to the VPU ops and invoke it from core init and resume paths.
No functional change for existing platforms.
--- drivers/media/platform/qcom/iris/iris_core.c | 4 ++++ drivers/media/platform/qcom/iris/iris_hfi_common.c | 4 ++++ drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + 3 files changed, 9 insertions(+)
drivers/media/platform/qcom/iris/iris_core.c +4 -0
@@ -45,6 +45,7 @@ static int iris_wait_for_system_response(struct iris_core *core)int iris_core_init (struct iris_core *core) { +const struct vpu_ops *vpu_ops = core->iris_platform_data->vpu_ops;int ret;mutex_lock (&core->lock);
@@ -78,6 +79,9 @@ int iris_core_init(struct iris_core *core)if (ret) goto error_unload_fw; +if (vpu_ops->disable_arp) + vpu_ops->disable_arp (core); + core->iris_firmware_data->init_hfi_ops (core); ret =iris_hfi_core_init (core);
drivers/media/platform/qcom/iris/iris_hfi_common.c +4 -0
@@ -144,6 +144,7 @@ int iris_hfi_pm_suspend(struct iris_core *core)int iris_hfi_pm_resume (struct iris_core *core) { +const struct vpu_ops *vpu_ops = core->iris_platform_data->vpu_ops;const struct iris_hfi_sys_ops *ops = core->hfi_sys_ops;int ret;
@@ -163,6 +164,9 @@ int iris_hfi_pm_resume(struct iris_core *core)if (ret) goto err_suspend_hw; +if (vpu_ops->disable_arp) + vpu_ops->disable_arp (core); + ret = ops->sys_interframe_powercollapse (core);if (ret) goto err_suspend_hw;
drivers/media/platform/qcom/iris/iris_vpu_common.h +1 -0
@@ -24,6 +24,7 @@ struct vpu_ops {int (*set_hwmode)(struct iris_core *core);void (*set_preset_registers)(struct iris_core *core);void (*interrupt_init)(struct iris_core *core); +void (*disable_arp)(struct iris_core *core); };int iris_vpu_boot_firmware (struct iris_core *core);
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 05/16] media: iris: add vpu op hook to disable ARP buffer
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Permanent memory leak of DMA buffers in iris_core_init() on hardware response timeout, which can be repeatedly triggered from userspace. --
commit 3a7fc135bf016aef8f9196cb8a7b617066640e5c
Author: Dikshita Agarwal <[email protected]>
media: iris: add vpu op hook to disable ARP buffer
This patch adds an optional disable_arp callback to the VPU operations to disable the ARP internal buffer on AR50LT platforms. The callback is invoked during the core initialization and power management resume paths.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_core.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_core.c int iris_core_init(struct iris_core *core) · line 87
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_core.c +3
-0@@ -78,6 +79,9 @@ int iris_core_init(struct iris_core *core)if (ret) goto error_unload_fw; +if (vpu_ops->disable_arp) + vpu_ops->disable_arp (core); + core->iris_firmware_data->init_hfi_ops (core); ret =iris_hfi_core_init (core);
[Severity: High]
This is a pre-existing issue, but could the error handling in iris_core_init() permanently leak DMA buffers?
If iris_wait_for_system_response() times out at the end of this function, it sets the state to IRIS_CORE_ERROR and returns a timeout error, but the DMA memory allocated earlier by iris_hfi_queues_init() is not freed.
A subsequent initialization attempt would then trigger this path:
} else if (core->state == IRIS_CORE_ERROR) {
ret = -EINVAL;
goto error;
}
...
error:
core->state = IRIS_CORE_DEINIT;This transitions the state to IRIS_CORE_DEINIT and still does not free the memory.
If a third initialization call is made, iris_core_init() proceeds with normal setup because the state is now IRIS_CORE_DEINIT. It will call iris_hfi_queues_init() again, overwriting core->iface_q_table_vaddr and core->sfr_vaddr, leaking the previously allocated contiguous DMA memory.
Is there a missing cleanup path for the DMA queues when a system response timeout occurs, or should the transition from IRIS_CORE_ERROR explicitly handle freeing these resources?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH v5 6/16 media: iris: Add platform data field for watchdog interrupt mask
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
For AR50LT core, the value of WRAPPER_INTR_STATUS_A2HWD_BMASK differs from the currently supported VPUs. In preparation for adding AR50LT support in subsequent patches, introduce a platform data field, wd_intr_mask, to capture the watchdog interrupt bitmask per platform.
--- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_platform_vpu2.c | 4 ++++ drivers/media/platform/qcom/iris/iris_platform_vpu3x.c | 7 +++++++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 8 +++++--- drivers/media/platform/qcom/iris/iris_vpu_register_defines.h | 1 - 5 files changed, 17 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +1 -0
@@ -315,6 +315,7 @@ struct iris_platform_data {u32 tz_cp_config_data_size;u32 num_vpp_pipe;bool no_aon; +u32 wd_intr_mask;u32 max_session_count;/* max number of macroblocks per frame supported */ u32 max_core_mbpf;
drivers/media/platform/qcom/iris/iris_platform_vpu2.c +4 -0
@@ -16,6 +16,8 @@#include "iris_platform_sc7280.h" #include "iris_platform_sm8250.h" +#define WRAPPER_INTR_STATUS_A2HWD_BMSK BIT(3) +static const struct iris_firmware_desc iris_vpu20_p1_gen1_desc = { .firmware_data = &iris_hfi_gen1_data, .get_vpu_buffer_size = iris_vpu_buf_size,
@@ -94,6 +96,7 @@ const struct iris_platform_data sc7280_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu2), .num_vpp_pipe = 1, .no_aon = true, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = 4096 * 2176 / 256 * 2 + 1920 * 1088 / 256,/* max spec for SC7280 is 4096x2176@60fps */
@@ -124,6 +127,7 @@ const struct iris_platform_data sm8250_data = { .tz_cp_config_data = tz_cp_config_vpu2, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu2), .num_vpp_pipe = 4, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K, .max_core_mbps = ((7680 * 4320) / 256) * 60,
drivers/media/platform/qcom/iris/iris_platform_vpu3x.c +7 -0
@@ -18,6 +18,8 @@#include "iris_platform_sm8750.h" #include "iris_platform_x1p42100.h" +#define WRAPPER_INTR_STATUS_A2HWD_BMSK BIT(3) +static const struct iris_firmware_desc iris_vpu30_p4_s6_gen2_desc = { .firmware_data = &iris_hfi_gen2_data, .get_vpu_buffer_size = iris_vpu_buf_size,
@@ -113,6 +115,7 @@ const struct iris_platform_data qcs8300_data = { .tz_cp_config_data = tz_cp_config_vpu3, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 2, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = ((4096 * 2176) / 256) * 4, .max_core_mbps = (((3840 * 2176) / 256) * 120),
@@ -142,6 +145,7 @@ const struct iris_platform_data sm8550_data = { .tz_cp_config_data = tz_cp_config_vpu3, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -179,6 +183,7 @@ const struct iris_platform_data sm8650_data = { .tz_cp_config_data = tz_cp_config_vpu3, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -208,6 +213,7 @@ const struct iris_platform_data sm8750_data = { .tz_cp_config_data = tz_cp_config_vpu3, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -243,6 +249,7 @@ const struct iris_platform_data x1p42100_data = { .tz_cp_config_data = tz_cp_config_vpu3, .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 1, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
drivers/media/platform/qcom/iris/iris_vpu_common.c +5 -3
@@ -109,11 +109,11 @@ void iris_vpu_raise_interrupt(struct iris_core *core)void iris_vpu_clear_interrupt (struct iris_core *core) { +u32 wd_intr_mask = core->iris_platform_data->wd_intr_mask;u32 intr_status, mask; intr_status =readl (core->reg_base +WRAPPER_INTR_STATUS ); - mask = (WRAPPER_INTR_STATUS_A2H_BMSK | -WRAPPER_INTR_STATUS_A2HWD_BMSK | + mask = (WRAPPER_INTR_STATUS_A2H_BMSK | wd_intr_mask |CTRL_INIT_IDLE_MSG_BMSK );if (intr_status & mask)
@@ -124,7 +124,9 @@ void iris_vpu_clear_interrupt(struct iris_core *core)int iris_vpu_watchdog (struct iris_core *core,u32 intr_status) { -if (intr_status &WRAPPER_INTR_STATUS_A2HWD_BMSK ) { +u32 wd_intr_mask = core->iris_platform_data->wd_intr_mask; + +if (intr_status & wd_intr_mask) {dev_err (core->dev,"received watchdog interrupt\n" );return -ETIME ; }
drivers/media/platform/qcom/iris/iris_vpu_register_defines.h +0 -1
@@ -41,7 +41,6 @@#define MSK_CORE_POWER_ON BIT(1)#define WRAPPER_INTR_STATUS (WRAPPER_BASE_OFFS + 0x0C) -#define WRAPPER_INTR_STATUS_A2HWD_BMSK BIT(3)#define WRAPPER_INTR_STATUS_A2H_BMSK BIT(2)#define WRAPPER_INTR_MASK (WRAPPER_BASE_OFFS + 0x10)
Signature · 1 line
2.47.3
PATCH v5 7/16 media: iris: Add platform flag for instantaneous bandwidth voting
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
AR50LT require explicit instantaneous bandwidth (IB) voting in addition to average bandwidth (AB) when configuring interconnect QoS. This requirement is due to QSB (Qualcomm System Bus) 128b to
QNS ( Qualcomm Network Switch) 256b conversion at video noc in AR50LT which is not needed for other IRIS cores.
In preparation of adding support for AR50LT core, introduce platform-configurable IB multiplier and enable IB voting for all SoCs. Existing platforms default to IB == AB, while AR50LT requires 2x peak bandwidth.
--- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_platform_vpu2.c | 2 ++ drivers/media/platform/qcom/iris/iris_platform_vpu3x.c | 5 +++++ drivers/media/platform/qcom/iris/iris_resources.c | 2 ++ 4 files changed, 10 insertions(+)
drivers/media/platform/qcom/iris/iris_platform_common.h +1 -0
@@ -316,6 +316,7 @@ struct iris_platform_data {u32 num_vpp_pipe;bool no_aon;u32 wd_intr_mask; +u32 icc_ib_multiplier;u32 max_session_count;/* max number of macroblocks per frame supported */ u32 max_core_mbpf;
drivers/media/platform/qcom/iris/iris_platform_vpu2.c +2 -0
@@ -97,6 +97,7 @@ const struct iris_platform_data sc7280_data = { .num_vpp_pipe = 1, .no_aon = true, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = 4096 * 2176 / 256 * 2 + 1920 * 1088 / 256,/* max spec for SC7280 is 4096x2176@60fps */
@@ -128,6 +129,7 @@ const struct iris_platform_data sm8250_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu2), .num_vpp_pipe = 4, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K, .max_core_mbps = ((7680 * 4320) / 256) * 60,
drivers/media/platform/qcom/iris/iris_platform_vpu3x.c +5 -0
@@ -116,6 +116,7 @@ const struct iris_platform_data qcs8300_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 2, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = ((4096 * 2176) / 256) * 4, .max_core_mbps = (((3840 * 2176) / 256) * 120),
@@ -146,6 +147,7 @@ const struct iris_platform_data sm8550_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -184,6 +186,7 @@ const struct iris_platform_data sm8650_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -214,6 +217,7 @@ const struct iris_platform_data sm8750_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 4, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
@@ -250,6 +254,7 @@ const struct iris_platform_data x1p42100_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_vpu3), .num_vpp_pipe = 1, .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK, + .icc_ib_multiplier = 1, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2, .max_core_mbps = ((7680 * 4320) / 256) * 60,
drivers/media/platform/qcom/iris/iris_resources.c +2 -0
@@ -18,6 +18,7 @@int iris_set_icc_bw (struct iris_core *core,unsigned long icc_bw) { +u32 icc_ib_multiplier = core->iris_platform_data->icc_ib_multiplier;unsigned long bw_kbps =0 , bw_prev =0 ;const struct icc_info *icc_tbl;int ret =0 , i;
@@ -36,6 +37,7 @@ int iris_set_icc_bw(struct iris_core *core, unsigned long icc_bw)return ret; core->icc_tbl[i].avg_bw = bw_kbps; + core->icc_tbl[i].peak_bw = bw_kbps * icc_ib_multiplier; core->power.icc_bw = bw_kbps;break ;
Signature · 1 line
2.47.3
PATCH v5 8/16 media: iris: skip PIPE if it is not supported by the platform
In reply to Dmitry BaryshkovAR50Lt doesn't support HFI_PROPERTY_PARAM_WORK_ROUTE. Tables for AR50LT won't have corresponding entry in the capability tables. Let iris_set_pipe() silently skip propgramming the property if there is no corresponding capability.
--- drivers/media/platform/qcom/iris/iris_ctrls.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/qcom/iris/iris_ctrls.c +3 -0
@@ -534,6 +534,9 @@ int iris_set_pipe(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)u32 work_route = inst->fw_caps[PIPE ].value;u32 hfi_id = inst->fw_caps[cap_id].hfi_id; +if (!hfi_id) +return 0 ; + return hfi_ops->session_set_property(inst, hfi_id, HFI_HOST_FLAGS_NONE, iris_get_port_info(inst, cap_id),
Signature · 1 line
2.47.3
PATCH v5 9/16 media: iris: Add framework support for AR50_LITE video core
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
Add power sequence for ar5lt core.
Add register handling for ar50lt by hooking up vpu op with ar50lt specific implemtation or resue from earlier generation wherever feasible.
--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 2 + drivers/media/platform/qcom/iris/iris_vpu2.c | 28 +---- drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c | 130 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 29 ++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 2 + 6 files changed, 164 insertions(+), 28 deletions(-)
drivers/media/platform/qcom/iris/Makefile +1 -0
@@ -26,6 +26,7 @@ qcom-iris-objs += iris_buffer.o \ iris_vpu2.o \ iris_vpu3x.o \ iris_vpu4x.o \ + iris_vpu_ar50lt.o \ iris_vpu_buffer.o \ iris_vpu_common.o \
drivers/media/platform/qcom/iris/iris_platform_common.h +2 -0
@@ -74,6 +74,7 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , + IRIS_THROTTLE_CLK, }; struct platform_clk_data {
@@ -315,6 +316,7 @@ struct iris_platform_data {u32 tz_cp_config_data_size;u32 num_vpp_pipe;bool no_aon; +bool no_rpmh;u32 wd_intr_mask;u32 icc_ib_multiplier;u32 max_session_count;
drivers/media/platform/qcom/iris/iris_vpu2.c +1 -27
@@ -12,38 +12,12 @@#include "iris_vpu_register_defines.h" -static u64 iris_vpu2_calc_freq (struct iris_inst *inst,size_t data_size) -{ -struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; -struct v4l2_format *inp_f = inst->fmt_src; -u32 mbs_per_second, mbpf, height, width; -unsigned long vpp_freq, vsp_freq; -u32 fps = inst->frame_rate; - - width =max (inp_f->fmt.pix_mp.width, inst->crop.width); - height =max (inp_f->fmt.pix_mp.height, inst->crop.height); - - mbpf =NUM_MBS_PER_FRAME (height, width); - mbs_per_second = mbpf * fps; - - vpp_freq = mbs_per_second * caps->mb_cycles_vpp; - -/* 21 / 20 is overhead factor */ - vpp_freq += vpp_freq /20 ; - vsp_freq = mbs_per_second * caps->mb_cycles_vsp; - -/* 10 / 7 is overhead factor */ - vsp_freq += ((fps * data_size *8 ) *10 ) /7 ; - -return max (vpp_freq, vsp_freq); -} -const struct vpu_ops iris_vpu2_ops = { .power_off_hw = iris_vpu_power_off_hw, .power_on_hw = iris_vpu_power_on_hw, .power_off_controller = iris_vpu_power_off_controller, .power_on_controller = iris_vpu_power_on_controller, - .calc_freq = iris_vpu2_calc_freq, + .calc_freq = iris_vpu2_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, .interrupt_init = iris_vpu_interrupt_init,
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c new file +130 -0
130 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_vpu_common.c +28 -1
@@ -97,7 +97,8 @@ int iris_vpu_boot_firmware(struct iris_core *core) }writel (HOST2XTENSA_INTR_ENABLE , core->reg_base +CPU_CS_H2XSOFTINTEN ); -writel (0x0 , core->reg_base +CPU_CS_X2RPMH ); +if (!core->iris_platform_data->no_rpmh) +writel (0x0 , core->reg_base +CPU_CS_X2RPMH );return 0 ; }
@@ -422,6 +423,32 @@ void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core)writel (0x1 , core->reg_base +WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 ); } +u64 iris_vpu2_calculate_frequency (struct iris_inst *inst,size_t data_size) +{ +struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; +struct v4l2_format *inp_f = inst->fmt_src; +u32 mbs_per_second, mbpf, height, width; +unsigned long vpp_freq, vsp_freq; +u32 fps = inst->frame_rate; + + width =max (inp_f->fmt.pix_mp.width, inst->crop.width); + height =max (inp_f->fmt.pix_mp.height, inst->crop.height); + + mbpf =NUM_MBS_PER_FRAME (height, width); + mbs_per_second = mbpf * fps; + + vpp_freq = mbs_per_second * caps->mb_cycles_vpp; + +/* 21 / 20 is overhead factor */ + vpp_freq += vpp_freq /20 ; + vsp_freq = mbs_per_second * caps->mb_cycles_vsp; + +/* 10 / 7 is overhead factor */ + vsp_freq += ((fps * data_size *8 ) *10 ) /7 ; + +return max (vpp_freq, vsp_freq); +} +u64 iris_vpu3x_vpu4x_calculate_frequency (struct iris_inst *inst,size_t data_size) {struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps;
drivers/media/platform/qcom/iris/iris_vpu_common.h +2 -0
@@ -13,6 +13,7 @@ extern const struct vpu_ops iris_vpu3_ops;extern const struct vpu_ops iris_vpu33_ops;extern const struct vpu_ops iris_vpu35_ops;extern const struct vpu_ops iris_vpu4x_ops; +extern const struct vpu_ops iris_vpu_ar50lt_ops;struct vpu_ops {void (*power_off_hw)(struct iris_core *core);
@@ -40,6 +41,7 @@ int iris_vpu_power_on(struct iris_core *core);int iris_vpu_power_off_controller (struct iris_core *core);void iris_vpu_power_off_hw (struct iris_core *core);void iris_vpu_power_off (struct iris_core *core); +u64 iris_vpu2_calculate_frequency (struct iris_inst *inst,size_t data_size);int iris_vpu35_vpu4x_power_off_controller (struct iris_core *core);int iris_vpu35_vpu4x_power_on_controller (struct iris_core *core);void iris_vpu35_vpu4x_program_bootup_registers (struct iris_core *core);
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 09/16] media: iris: Add framework support for AR50_LITE video core
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [High] pm_runtime_get_sync() leaks usage count on failure in iris_enable_power_domains().
- [High] iris_disable_power_domains() bails early on OPP failure, bypassing pm_runtime_put_sync() and leaking the PM reference.
- [High] 32-bit multiplication in VPU frequency calculations silently overflows, leading to drastic underclocking at high resolutions/framerates.
- [High] The function iris_vpu_boot_firmware() returns success (0) even when it detects a firmware boot error.
--
commit 7269410ec2faaa10691a53dc0ab6c6efcc23fc3e
Author: Dikshita Agarwal <[email protected]>
media: iris: Add framework support for AR50_LITE video core
Add power sequence for ar5lt core. Add register handling for ar50lt by hooking up vpu op with ar50lt specific implemtation or resue from earlier generation wherever feasible.
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c new file +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c line 60
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c new file +5
-0+static int iris_vpu_ar50lt_power_on_controller (struct iris_core *core) +{ +int ret; + + ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]);
[Severity: High]
This isn't a bug introduced by this patch, but do iris_enable_power_domains() and iris_disable_power_domains() leak runtime PM references on failure?
In drivers/media/platform/qcom/iris/iris_resources.c, iris_enable_power_domains() calls:
ret = pm_runtime_get_sync(pd_dev); if (ret < 0) return ret;
If the resume fails, it returns a negative error code but leaves the usage count incremented without calling pm_runtime_put_noidle().
Similarly, iris_disable_power_domains() has an early return that bypasses pm_runtime_put_sync():
ret = iris_opp_set_rate(core->dev, 0); if (ret) return ret; pm_runtime_put_sync(pd_dev);
If iris_opp_set_rate() fails, the pm_runtime_put_sync() call is skipped, permanently leaking the runtime PM reference and leaving the power domain active.
[ ... ]
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_vpu_common.c +0
-0
drivers/media/platform/qcom/iris/iris_vpu_common.c int iris_vpu_boot_firmware(struct iris_core *core) · line 104
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_vpu_common.c +2
-1@@ -97,7 +97,8 @@ int iris_vpu_boot_firmware(struct iris_core *core) }writel (HOST2XTENSA_INTR_ENABLE , core->reg_base +CPU_CS_H2XSOFTINTEN ); -writel (0x0 , core->reg_base +CPU_CS_X2RPMH ); +if (!core->iris_platform_data->no_rpmh) +writel (0x0 , core->reg_base +CPU_CS_X2RPMH );return 0 ; }
[Severity: High]
This isn't a bug introduced by this patch, but does iris_vpu_boot_firmware() return success even when it detects a firmware boot error?
Earlier in this function:
if ((ctrl_status & CTRL_ERROR_STATUS__M) == 0x4) {
dev_err(core->dev, "invalid setting for uc_region\n");
break;
}Because the loop is exited early via break, the count does not reach max_tries. This skips the subsequent timeout check (if (count >= max_tries)), and the function incorrectly falls through to return 0.
Could this cause the caller to proceed assuming the firmware booted correctly, leading to undefined behavior and hardware timeouts later?
[ ... ]
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_vpu_common.c +5
-0@@ -422,6 +423,32 @@ void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core)writel (0x1 , core->reg_base +WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 ); } +u64 iris_vpu2_calculate_frequency (struct iris_inst *inst,size_t data_size) +{ +struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; +struct v4l2_format *inp_f = inst->fmt_src; +u32 mbs_per_second, mbpf, height, width;
drivers/media/platform/qcom/iris/iris_vpu_common.c void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core) · line 440
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_common.c +10
-0+unsigned long vpp_freq, vsp_freq; +u32 fps = inst->frame_rate; + + width =max (inp_f->fmt.pix_mp.width, inst->crop.width); + height =max (inp_f->fmt.pix_mp.height, inst->crop.height); + + mbpf =NUM_MBS_PER_FRAME (height, width); + mbs_per_second = mbpf * fps; + + vpp_freq = mbs_per_second * caps->mb_cycles_vpp;
[Severity: High]
This is a pre-existing issue, but does this 32-bit multiplication silently overflow before assignment?
Both mbs_per_second and caps->mb_cycles_vpp are u32. For high resolutions and framerates (like 8K at 240+ FPS), mbs_per_second can reach ~33M and mb_cycles_vpp is ~200. This results in a product greater than 6.6 billion, exceeding the u32 maximum.
The value wraps around before being cast to unsigned long, which might cause the requested clock frequency to be set drastically lower than required.
The same multiplication overflow also exists in iris_vpu3x_vpu4x_calculate_frequency() where mult_frac() internally executes a u32 * u32 operation.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
Vikash Garodia
maintainerRe: [PATCH v5 09/16] media: iris: Add framework support for AR50_LITE video core
In reply to Dmitry BaryshkovQuoted 35 lines · Dmitry Baryshkov
From: Dikshita Agarwal <[email protected]>
Add power sequence for ar5lt core.
Add register handling for ar50lt by hooking up vpu op with ar50lt specific implemtation or resue from earlier generation wherever feasible.Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 2 + drivers/media/platform/qcom/iris/iris_vpu2.c | 28 +---- drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c | 130 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 29 ++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 2 + 6 files changed, 164 insertions(+), 28 deletions(-)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -26,6 +26,7 @@ qcom-iris-objs += iris_buffer.o \ iris_vpu2.o \ iris_vpu3x.o \ iris_vpu4x.o \ + iris_vpu_ar50lt.o \ iris_vpu_buffer.o \ iris_vpu_common.o \drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0
drivers/media/platform/qcom/iris/iris_platform_common.h enum platform_clk_type { · line 77
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -74,6 +74,7 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , + IRIS_THROTTLE_CLK,
As we extend the common enum for (one off probably) SOC specific entries, should we bring in the changes to migrate this to per block clock data, something which was done here [1] ?
Quoted 159 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0};struct platform_clk_data {@@ -315,6 +316,7 @@ struct iris_platform_data {u32 tz_cp_config_data_size;u32 num_vpp_pipe;bool no_aon; +bool no_rpmh;u32 wd_intr_mask;u32 icc_ib_multiplier;u32 max_session_count;drivers/media/platform/qcom/iris/iris_vpu2.c +1
-27@@ -12,38 +12,12 @@#include "iris_vpu_register_defines.h" -static u64 iris_vpu2_calc_freq (struct iris_inst *inst,size_t data_size) -{ -struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; -struct v4l2_format *inp_f = inst->fmt_src; -u32 mbs_per_second, mbpf, height, width; -unsigned long vpp_freq, vsp_freq; -u32 fps = inst->frame_rate; - - width =max (inp_f->fmt.pix_mp.width, inst->crop.width); - height =max (inp_f->fmt.pix_mp.height, inst->crop.height); - - mbpf =NUM_MBS_PER_FRAME (height, width); - mbs_per_second = mbpf * fps; - - vpp_freq = mbs_per_second * caps->mb_cycles_vpp; - -/* 21 / 20 is overhead factor */ - vpp_freq += vpp_freq /20 ; - vsp_freq = mbs_per_second * caps->mb_cycles_vsp; - -/* 10 / 7 is overhead factor */ - vsp_freq += ((fps * data_size *8 ) *10 ) /7 ; - -return max (vpp_freq, vsp_freq); -} -const struct vpu_ops iris_vpu2_ops = { .power_off_hw = iris_vpu_power_off_hw, .power_on_hw = iris_vpu_power_on_hw, .power_off_controller = iris_vpu_power_off_controller, .power_on_controller = iris_vpu_power_on_controller, - .calc_freq = iris_vpu2_calc_freq, + .calc_freq = iris_vpu2_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, .set_preset_registers = iris_vpu_set_preset_registers, .interrupt_init = iris_vpu_interrupt_init,drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c new file +98
-0@@ -0,0 +1,130 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2026 Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include <linux/bits.h> +#include <linux/iopoll.h> +#include <linux/reset.h> + +#include "iris_instance.h" +#include "iris_vpu_common.h" + +#include "iris_vpu_register_defines.h" + +#define WRAPPER_INTR_MASK_A2HVCODEC_BMSK_AR50LT BIT(3) + +#define WRAPPER_VCODEC0_CLOCK_CONFIG_AR50LT 0xb0080 + +#define CPU_CS_VCICMD 0xa0020 +#define CPU_CS_VCICMD_ARP_OFF 0x1 + +static void iris_vpu_ar50lt_set_preset_registers (struct iris_core *core) +{ +writel (0x0 , core->reg_base +WRAPPER_VCODEC0_CLOCK_CONFIG_AR50LT ); +} + +static void iris_vpu_ar50lt_interrupt_init (struct iris_core *core) +{ +writel (WRAPPER_INTR_MASK_A2HVCODEC_BMSK_AR50LT , core->reg_base +WRAPPER_INTR_MASK ); +} + +static void iris_vpu_ar50lt_disable_arp (struct iris_core *core) +{ +writel (CPU_CS_VCICMD_ARP_OFF , core->reg_base +CPU_CS_VCICMD ); +} + +static int iris_vpu_ar50lt_power_off_controller (struct iris_core *core) +{ +iris_disable_unprepare_clock (core,IRIS_AHB_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + +return 0 ; +} + +static void iris_vpu_ar50lt_power_off_hw (struct iris_core *core) +{ +dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ], false); +iris_disable_unprepare_clock (core,IRIS_THROTTLE_CLK ); +iris_disable_unprepare_clock (core,IRIS_HW_AHB_CLK ); +iris_disable_unprepare_clock (core,IRIS_HW_CLK ); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +} + +static int iris_vpu_ar50lt_power_on_controller (struct iris_core *core) +{ +int ret; + + ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +if (ret) +return ret; + + ret =iris_prepare_enable_clock (core,IRIS_CTRL_CLK ); +if (ret) + goto err_disable_power; + + ret =iris_prepare_enable_clock (core,IRIS_AXI_CLK ); +if (ret && ret != -ENOENT ) + goto err_disable_ctrl_clock; + + ret =iris_prepare_enable_clock (core,IRIS_AHB_CLK ); +if (ret) + goto err_disable_axi_clock; + +return 0 ; + +err_disable_axi_clock: +iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +err_disable_ctrl_clock: +iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); +err_disable_power: +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + +return ret; +} + +static int iris_vpu_ar50lt_power_on_hw (struct iris_core *core) +{ +int ret; + + ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +if (ret) +return ret; + + ret =iris_prepare_enable_clock (core,IRIS_HW_CLK ); +if (ret) + goto err_disable_power;
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c line 108
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_ar50lt.c new file +10
-0+ + ret =iris_prepare_enable_clock (core,IRIS_HW_AHB_CLK ); +if (ret) + goto err_disable_hw_clock; + + ret =iris_prepare_enable_clock (core,IRIS_THROTTLE_CLK ); +if (ret) + goto err_disable_hw_ahb_clock; + +return 0 ;
...lot of these per soc specific clock handling would be removed.
Regards,
Vikash
PATCH v5 10/16 media: iris: add minimal GET_PROPERTY implementation
In reply to Dmitry BaryshkovAR50Lt with the Gen1 firmware requires host to read HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS property, otherwise it doesn't update internal data and fails the HFI_CMD_SESSION_LOAD_RESOURCES command. Implement minimal support for querying the properties from the firmware.
--- drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen1_command.c | 21 +++++++++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_defines.h | 15 +++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_response.c | 6 ++++++ 4 files changed, 43 insertions(+)
drivers/media/platform/qcom/iris/iris_hfi_common.h +1 -0
@@ -121,6 +121,7 @@ struct iris_hfi_session_ops {int (*session_set_property)(struct iris_inst *inst,u32 packet_type,u32 flag,u32 plane,u32 payload_type,void *payload,u32 payload_size); +int (*session_get_property)(struct iris_inst *inst,u32 packet_type);int (*session_open)(struct iris_inst *inst);int (*session_start)(struct iris_inst *inst,u32 plane);int (*session_queue_buf)(struct iris_inst *inst,struct iris_buffer *buffer);
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +21 -0
@@ -1117,10 +1117,31 @@ static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 preturn 0 ; } +static int iris_hfi_gen1_session_get_property (struct iris_inst *inst,u32 packet_type) +{ +struct hfi_session_get_property_pkt pkt; +int ret; + + pkt.shdr.hdr.size =sizeof (pkt); + pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_GET_PROPERTY ; + pkt.shdr.session_id = inst->session_id; + pkt.num_properties =1 ; + pkt.data = packet_type; + +reinit_completion (&inst->completion); + + ret =iris_hfi_queue_cmd_write (inst->core, &pkt, pkt.shdr.hdr.size); +if (ret) +return ret; + +return iris_wait_for_session_response (inst, false); +} +static const struct iris_hfi_session_ops iris_hfi_gen1_session_ops = { .session_open = iris_hfi_gen1_session_open, .session_set_config_params = iris_hfi_gen1_session_set_config_params, .session_set_property = iris_hfi_gen1_session_set_property, + .session_get_property = iris_hfi_gen1_session_get_property, .session_start = iris_hfi_gen1_session_start, .session_queue_buf = iris_hfi_gen1_session_queue_buffer, .session_release_buf = iris_hfi_gen1_session_unset_buffers,
drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h +15 -0
@@ -35,6 +35,7 @@#define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004#define HFI_CMD_SESSION_FILL_BUFFER 0x211005#define HFI_CMD_SESSION_FLUSH 0x211008 +#define HFI_CMD_SESSION_GET_PROPERTY 0x211009#define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b#define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c#define HFI_CMD_SESSION_CONTINUE 0x21100d
@@ -113,6 +114,7 @@#define HFI_MSG_SESSION_FLUSH 0x221006#define HFI_MSG_SESSION_EMPTY_BUFFER 0x221007#define HFI_MSG_SESSION_FILL_BUFFER 0x221008 +#define HFI_MSG_SESSION_PROPERTY_INFO 0x221009#define HFI_MSG_SESSION_RELEASE_RESOURCES 0x22100a#define HFI_MSG_SESSION_RELEASE_BUFFERS 0x22100c
@@ -205,6 +207,12 @@ struct hfi_session_set_property_pkt {u32 data[]; }; +struct hfi_session_get_property_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 data; +}; +struct hfi_sys_pc_prep_pkt {struct hfi_pkt_hdr hdr; };
@@ -574,6 +582,13 @@ struct hfi_msg_session_fbd_uncompressed_plane0_pkt {u32 data[]; }; +struct hfi_msg_session_property_info_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 property; +u8 data[]; +}; +struct hfi_msg_session_release_buffers_done_pkt {struct hfi_msg_session_hdr_pkt shdr;u32 num_buffers;
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +6 -0
@@ -591,6 +591,10 @@ static const struct iris_hfi_gen1_response_pkt_info pkt_infos[] = { .pkt = HFI_MSG_SESSION_RELEASE_BUFFERS, .pkt_sz = sizeof(struct hfi_msg_session_release_buffers_done_pkt), }, + { + .pkt = HFI_MSG_SESSION_PROPERTY_INFO, + .pkt_sz = sizeof(struct hfi_msg_session_property_info_pkt), + }, };static void iris_hfi_gen1_handle_response (struct iris_core *core,void *response)
@@ -652,6 +656,8 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *responseiris_hfi_gen1_session_etb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); + }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { +complete (&inst->completion); }else {struct hfi_msg_session_hdr_pkt *shdr;
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 10/16] media: iris: add minimal GET_PROPERTY implementation
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Use-After-Free due to missing reference counting in instance lookup.
- [High] Unsafe release of instance lock during firmware wait allows concurrent IOCTLs to clobber completion state. --
commit d766418e0dabcbcbb8dc9a3f16b8a80a51ec61f4
Author: Dmitry Baryshkov <[email protected]>
media: iris: add minimal GET_PROPERTY implementation
This commit adds minimal support for querying properties from the firmware to satisfy Gen1 firmware requirements for AR50Lt. It implements the session_get_property operation and handles the resulting property info messages.
Quoted 17 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +9
-0@@ -1117,10 +1117,31 @@ static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 preturn 0 ; } +static int iris_hfi_gen1_session_get_property (struct iris_inst *inst,u32 packet_type) +{ +struct hfi_session_get_property_pkt pkt; +int ret; + + pkt.shdr.hdr.size =sizeof (pkt); + pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_GET_PROPERTY ; + pkt.shdr.session_id = inst->session_id; + pkt.num_properties =1 ;
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 p · line 1138
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +10
-0+ pkt.data = packet_type; + +reinit_completion (&inst->completion); + + ret =iris_hfi_queue_cmd_write (inst->core, &pkt, pkt.shdr.hdr.size); +if (ret) +return ret; + +return iris_wait_for_session_response (inst, false); +}
[Severity: High]
This is a pre-existing issue, but the newly added function utilizes a pattern that might be unsafe.
In iris_wait_for_session_response(), inst->lock is explicitly dropped while waiting for inst->completion. Because the driver does not appear to use vdev->lock to serialize V4L2 ioctls, dropping inst->lock could expose the driver to concurrent ioctls.
Could a second thread acquire inst->lock, issue another firmware command, and call reinit_completion(&inst->completion), erasing the state the first thread is waiting on?
If so, when the firmware finally responds, complete(&inst->completion) might arbitrarily wake up the wrong thread and desynchronize the driver state.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response · line 660
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +2
-0@@ -652,6 +656,8 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *responseiris_hfi_gen1_session_etb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); + }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { +complete (&inst->completion);
[Severity: Critical]
This isn't a bug introduced by this patch, but there appears to be a critical structural flaw with how the instance is handled here.
Earlier in iris_hfi_gen1_handle_response(), iris_get_instance() looks up an iris_inst from the core->instances list while holding core->lock, but returns the raw pointer without incrementing any reference count, and then drops core->lock.
The response handler then subsequently attempts to acquire mutex_lock(&inst->lock). If a concurrent thread executing iris_close() acquires core->lock via iris_remove_session(), removes the instance from the list, and then calls kfree(inst), could the IRQ handler end up executing a locking operation on freed memory?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
Re: [PATCH v5 10/16] media: iris: add minimal GET_PROPERTY implementation
In reply to Dmitry BaryshkovQuoted 125 lines · Dmitry Baryshkov
AR50Lt with the Gen1 firmware requires host to read
HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTSproperty, otherwise it doesn't update internal data and fails theHFI_CMD_SESSION_LOAD_RESOURCEScommand. Implement minimal support for querying the properties from the firmware.Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen1_command.c | 21 +++++++++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_defines.h | 15 +++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_response.c | 6 ++++++ 4 files changed, 43 insertions(+)drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -121,6 +121,7 @@ struct iris_hfi_session_ops {int (*session_set_property)(struct iris_inst *inst,u32 packet_type,u32 flag,u32 plane,u32 payload_type,void *payload,u32 payload_size); +int (*session_get_property)(struct iris_inst *inst,u32 packet_type);int (*session_open)(struct iris_inst *inst);int (*session_start)(struct iris_inst *inst,u32 plane);int (*session_queue_buf)(struct iris_inst *inst,struct iris_buffer *buffer);drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +21
-0@@ -1117,10 +1117,31 @@ static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 preturn 0 ; } +static int iris_hfi_gen1_session_get_property (struct iris_inst *inst,u32 packet_type) +{ +struct hfi_session_get_property_pkt pkt; +int ret; + + pkt.shdr.hdr.size =sizeof (pkt); + pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_GET_PROPERTY ; + pkt.shdr.session_id = inst->session_id; + pkt.num_properties =1 ; + pkt.data = packet_type; + +reinit_completion (&inst->completion); + + ret =iris_hfi_queue_cmd_write (inst->core, &pkt, pkt.shdr.hdr.size); +if (ret) +return ret; + +return iris_wait_for_session_response (inst, false); +} +static const struct iris_hfi_session_ops iris_hfi_gen1_session_ops = { .session_open = iris_hfi_gen1_session_open, .session_set_config_params = iris_hfi_gen1_session_set_config_params, .session_set_property = iris_hfi_gen1_session_set_property, + .session_get_property = iris_hfi_gen1_session_get_property, .session_start = iris_hfi_gen1_session_start, .session_queue_buf = iris_hfi_gen1_session_queue_buffer, .session_release_buf = iris_hfi_gen1_session_unset_buffers,drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h +15
-0@@ -35,6 +35,7 @@#define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004#define HFI_CMD_SESSION_FILL_BUFFER 0x211005#define HFI_CMD_SESSION_FLUSH 0x211008 +#define HFI_CMD_SESSION_GET_PROPERTY 0x211009#define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b#define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c#define HFI_CMD_SESSION_CONTINUE 0x21100d@@ -113,6 +114,7 @@#define HFI_MSG_SESSION_FLUSH 0x221006#define HFI_MSG_SESSION_EMPTY_BUFFER 0x221007#define HFI_MSG_SESSION_FILL_BUFFER 0x221008 +#define HFI_MSG_SESSION_PROPERTY_INFO 0x221009#define HFI_MSG_SESSION_RELEASE_RESOURCES 0x22100a#define HFI_MSG_SESSION_RELEASE_BUFFERS 0x22100c@@ -205,6 +207,12 @@ struct hfi_session_set_property_pkt {u32 data[]; }; +struct hfi_session_get_property_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 data; +}; +struct hfi_sys_pc_prep_pkt {struct hfi_pkt_hdr hdr; };@@ -574,6 +582,13 @@ struct hfi_msg_session_fbd_uncompressed_plane0_pkt {u32 data[]; }; +struct hfi_msg_session_property_info_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 property; +u8 data[]; +}; +struct hfi_msg_session_release_buffers_done_pkt {struct hfi_msg_session_hdr_pkt shdr;u32 num_buffers;drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +4
-0@@ -591,6 +591,10 @@ static const struct iris_hfi_gen1_response_pkt_info pkt_infos[] = { .pkt = HFI_MSG_SESSION_RELEASE_BUFFERS, .pkt_sz = sizeof(struct hfi_msg_session_release_buffers_done_pkt), }, + { + .pkt = HFI_MSG_SESSION_PROPERTY_INFO, + .pkt_sz = sizeof(struct hfi_msg_session_property_info_pkt), + }, };static void iris_hfi_gen1_handle_response (struct iris_core *core,void *response)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response · line 663
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +2
-0@@ -652,6 +656,8 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *responseiris_hfi_gen1_session_etb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); + }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { +complete (&inst->completion); }else {struct hfi_msg_session_hdr_pkt *shdr;
Re: [PATCH v5 10/16] media: iris: add minimal GET_PROPERTY implementation
In reply to Dmitry BaryshkovQuoted 49 lines · Dmitry Baryshkov
AR50Lt with the Gen1 firmware requires host to read
HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTSproperty, otherwise it doesn't update internal data and fails theHFI_CMD_SESSION_LOAD_RESOURCEScommand. Implement minimal support for querying the properties from the firmware.Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen1_command.c | 21 +++++++++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_defines.h | 15 +++++++++++++++ .../platform/qcom/iris/iris_hfi_gen1_response.c | 6 ++++++ 4 files changed, 43 insertions(+)drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -121,6 +121,7 @@ struct iris_hfi_session_ops {int (*session_set_property)(struct iris_inst *inst,u32 packet_type,u32 flag,u32 plane,u32 payload_type,void *payload,u32 payload_size); +int (*session_get_property)(struct iris_inst *inst,u32 packet_type);int (*session_open)(struct iris_inst *inst);int (*session_start)(struct iris_inst *inst,u32 plane);int (*session_queue_buf)(struct iris_inst *inst,struct iris_buffer *buffer);drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +15
-0@@ -1117,10 +1117,31 @@ static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 preturn 0 ; } +static int iris_hfi_gen1_session_get_property (struct iris_inst *inst,u32 packet_type) +{ +struct hfi_session_get_property_pkt pkt; +int ret; + + pkt.shdr.hdr.size =sizeof (pkt); + pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_GET_PROPERTY ; + pkt.shdr.session_id = inst->session_id; + pkt.num_properties =1 ; + pkt.data = packet_type; + +reinit_completion (&inst->completion); + + ret =iris_hfi_queue_cmd_write (inst->core, &pkt, pkt.shdr.hdr.size); +if (ret)
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 p · line 1144
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +6
-0+return ret; + +return iris_wait_for_session_response (inst, false); +} +static const struct iris_hfi_session_ops iris_hfi_gen1_session_ops = { .session_open = iris_hfi_gen1_session_open, .session_set_config_params = iris_hfi_gen1_session_set_config_params, .session_set_property = iris_hfi_gen1_session_set_property, + .session_get_property = iris_hfi_gen1_session_get_property,
was looking for caller for this property, saw that in patch#12 to update the size. Commit should have mentioned about it.
Quoted 67 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +0
-0.session_start = iris_hfi_gen1_session_start, .session_queue_buf = iris_hfi_gen1_session_queue_buffer, .session_release_buf = iris_hfi_gen1_session_unset_buffers,drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h +15
-0@@ -35,6 +35,7 @@#define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004#define HFI_CMD_SESSION_FILL_BUFFER 0x211005#define HFI_CMD_SESSION_FLUSH 0x211008 +#define HFI_CMD_SESSION_GET_PROPERTY 0x211009#define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b#define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c#define HFI_CMD_SESSION_CONTINUE 0x21100d@@ -113,6 +114,7 @@#define HFI_MSG_SESSION_FLUSH 0x221006#define HFI_MSG_SESSION_EMPTY_BUFFER 0x221007#define HFI_MSG_SESSION_FILL_BUFFER 0x221008 +#define HFI_MSG_SESSION_PROPERTY_INFO 0x221009#define HFI_MSG_SESSION_RELEASE_RESOURCES 0x22100a#define HFI_MSG_SESSION_RELEASE_BUFFERS 0x22100c@@ -205,6 +207,12 @@ struct hfi_session_set_property_pkt {u32 data[]; }; +struct hfi_session_get_property_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 data; +}; +struct hfi_sys_pc_prep_pkt {struct hfi_pkt_hdr hdr; };@@ -574,6 +582,13 @@ struct hfi_msg_session_fbd_uncompressed_plane0_pkt {u32 data[]; }; +struct hfi_msg_session_property_info_pkt { +struct hfi_session_hdr_pkt shdr; +u32 num_properties; +u32 property; +u8 data[]; +}; +struct hfi_msg_session_release_buffers_done_pkt {struct hfi_msg_session_hdr_pkt shdr;u32 num_buffers;drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +4
-0@@ -591,6 +591,10 @@ static const struct iris_hfi_gen1_response_pkt_info pkt_infos[] = { .pkt = HFI_MSG_SESSION_RELEASE_BUFFERS, .pkt_sz = sizeof(struct hfi_msg_session_release_buffers_done_pkt), }, + { + .pkt = HFI_MSG_SESSION_PROPERTY_INFO, + .pkt_sz = sizeof(struct hfi_msg_session_property_info_pkt), + }, };static void iris_hfi_gen1_handle_response (struct iris_core *core,void *response)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response · line 663
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +2
-0@@ -652,6 +656,8 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *responseiris_hfi_gen1_session_etb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); + }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { +complete (&inst->completion); }else {struct hfi_msg_session_hdr_pkt *shdr;
PATCH v5 11/16 media: iris: update buffer requirements based on received info
In reply to Dmitry BaryshkovUpon receiving data for HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS the driver should update buffer sizes and counts from the received data. Implement corresponding functionality updating buffers data. This will be used for upcoming support of AR50Lt platforms with Gen1 firmware.
--- .../platform/qcom/iris/iris_hfi_gen1_response.c | 75 +++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +74 -1
@@ -533,6 +533,79 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet)dev_err (core->dev,"error in ftb done\n" ); } +static enum iris_buffer_type iris_hfi_gen1_buf_type (struct iris_inst *inst,u32 type) +{ +switch (type) { +case HFI_BUFFER_INPUT : +return BUF_INPUT ; +case HFI_BUFFER_OUTPUT : +if (iris_split_mode_enabled (inst)) +return BUF_DPB ; +return BUF_OUTPUT ; +case HFI_BUFFER_OUTPUT2 : +if (iris_split_mode_enabled (inst)) +return BUF_OUTPUT ; +return BUF_DPB ; +case HFI_BUFFER_INTERNAL_PERSIST_1 : +return BUF_PERSIST ; +case HFI_BUFFER_INTERNAL_SCRATCH : +return BUF_BIN ; +case HFI_BUFFER_INTERNAL_SCRATCH_1 : +return BUF_SCRATCH_1 ; +case HFI_BUFFER_INTERNAL_SCRATCH_2 : +return BUF_SCRATCH_2 ; +case HFI_BUFFER_INTERNAL_PERSIST : +return BUF_ARP ; +default : +return -EINVAL ; + } +} + +static void iris_hfi_gen1_session_buffer_requirements (struct iris_inst *inst, +void *data,size_t size) +{ +struct hfi_buffer_requirements *req; + +if (!size || size %sizeof (*req)) +return ; + +for (req = data; size; size -=sizeof (*req), req++) { +enum iris_buffer_type type =iris_hfi_gen1_buf_type (inst, req->type); + +if (type == -EINVAL ) +continue ; + +/* on relevant platforms hold_count and min_count are swapped */ + inst->buffers[type].min_count = req->hold_count; + inst->buffers[type].size = req->size; + +if (type ==BUF_OUTPUT ) + inst->fw_min_count = req->count_actual; + } +} + +static void iris_hfi_gen1_session_property_info (struct iris_inst *inst,void *packet) +{ +struct hfi_msg_session_property_info_pkt *pkt = packet; + +if (!pkt->num_properties) { +dev_err (inst->core->dev,"error, no properties\n" ); + goto out; + } + +switch (pkt->property) { +case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS : +iris_hfi_gen1_session_buffer_requirements (inst, pkt->data, + pkt->shdr.hdr.size -sizeof (*pkt)); +break ; +default : +dev_warn (inst->core->dev,"unknown property id: %x\n" , pkt->property); + } + +out: +complete (&inst->completion); +} +struct iris_hfi_gen1_response_pkt_info {u32 pkt;u32 pkt_sz;
@@ -657,7 +730,7 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { -complete (&inst->completion); +iris_hfi_gen1_session_property_info (inst, hdr); }else {struct hfi_msg_session_hdr_pkt *shdr;
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 11/16] media: iris: update buffer requirements based on received info
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Concurrent handling of HFI response packets and instance teardown can result in a Use-After-Free (UAF) of inst. --
commit 39194b5e5ad26925b8c03d02889401ec6e1fa21d
Author: Dmitry Baryshkov <[email protected]>
media: iris: update buffer requirements based on received info
Upon receiving data for HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS the driver should update buffer sizes and counts from the received data. This will be used for upcoming support of AR50Lt platforms.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response · line 735
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +1
-1@@ -657,7 +730,7 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { -complete (&inst->completion); +iris_hfi_gen1_session_property_info (inst, hdr); }else {struct hfi_msg_session_hdr_pkt *shdr;
[Severity: High]
This is a pre-existing issue, but can concurrent handling of HFI response packets and instance teardown result in a use-after-free of the inst pointer?
Looking at the start of iris_hfi_gen1_handle_response(), it calls iris_get_instance() which retrieves the inst pointer from the core list without incrementing any reference count:
drivers/media/platform/qcom/iris/iris_utils.c:iris_get_instance() {
list_for_each_entry(inst, &core->instances, list) {
if (inst->session_id == session_id) {
mutex_unlock(&core->lock);
return inst;
}
}
}The asynchronous response handler then blocks trying to acquire mutex_lock(&inst->lock).
Concurrently, if iris_close() executes and calls iris_session_close(), it can temporarily unlock inst->lock while waiting for the final HFI_MSG_SYS_SESSION_END response. This allows iris_close() to eventually finish, remove the session, unlock and destroy the mutex, and free the memory:
drivers/media/platform/qcom/iris/iris_vidc.c:iris_close() {
iris_remove_session(inst);
mutex_unlock(&inst->lock);
mutex_destroy(&inst->ctx_q_lock);
mutex_destroy(&inst->lock);
...
kfree(inst);
}If a spurious or trailing firmware message is processed for the same session, the response handler could wake up when the lock is released by iris_close(), successfully acquire the destroyed lock, and dereference the freed inst memory.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
Vikash Garodia
maintainerRe: [PATCH v5 11/16] media: iris: update buffer requirements based on received info
In reply to Dmitry BaryshkovQuoted 70 lines · Dmitry Baryshkov
Upon receiving data for
HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTSthe driver should update buffer sizes and counts from the received data. Implement corresponding functionality updating buffers data. This will be used for upcoming support of AR50Lt platforms with Gen1 firmware.Signed-off-by Dmitry Baryshkov <[email protected]>--- .../platform/qcom/iris/iris_hfi_gen1_response.c | 75 +++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +52
-0@@ -533,6 +533,79 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet)dev_err (core->dev,"error in ftb done\n" ); } +static enum iris_buffer_type iris_hfi_gen1_buf_type (struct iris_inst *inst,u32 type) +{ +switch (type) { +case HFI_BUFFER_INPUT : +return BUF_INPUT ; +case HFI_BUFFER_OUTPUT : +if (iris_split_mode_enabled (inst)) +return BUF_DPB ; +return BUF_OUTPUT ; +case HFI_BUFFER_OUTPUT2 : +if (iris_split_mode_enabled (inst)) +return BUF_OUTPUT ; +return BUF_DPB ; +case HFI_BUFFER_INTERNAL_PERSIST_1 : +return BUF_PERSIST ; +case HFI_BUFFER_INTERNAL_SCRATCH : +return BUF_BIN ; +case HFI_BUFFER_INTERNAL_SCRATCH_1 : +return BUF_SCRATCH_1 ; +case HFI_BUFFER_INTERNAL_SCRATCH_2 : +return BUF_SCRATCH_2 ; +case HFI_BUFFER_INTERNAL_PERSIST : +return BUF_ARP ; +default : +return -EINVAL ; + } +} + +static void iris_hfi_gen1_session_buffer_requirements (struct iris_inst *inst, +void *data,size_t size) +{ +struct hfi_buffer_requirements *req; + +if (!size || size %sizeof (*req)) +return ; + +for (req = data; size; size -=sizeof (*req), req++) { +enum iris_buffer_type type =iris_hfi_gen1_buf_type (inst, req->type); + +if (type == -EINVAL ) +continue ; + +/* on relevant platforms hold_count and min_count are swapped */ + inst->buffers[type].min_count = req->hold_count; + inst->buffers[type].size = req->size; + +if (type ==BUF_OUTPUT ) + inst->fw_min_count = req->count_actual; + } +} + +static void iris_hfi_gen1_session_property_info (struct iris_inst *inst,void *packet)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) · line 597
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +10
-0+{ +struct hfi_msg_session_property_info_pkt *pkt = packet; + +if (!pkt->num_properties) { +dev_err (inst->core->dev,"error, no properties\n" ); + goto out; + } + +switch (pkt->property) { +case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS :
If i check the venus message parsing logic, it loops through the packet till it hits the case. Here, we are assuming the first packet type, in the pkt to be the property "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS". There can be multiple properties in the packet, and if "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS" is not the first one, the usecase would break with incorrect buffer sizes.
Quoted 16 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +11
-0+iris_hfi_gen1_session_buffer_requirements (inst, pkt->data, + pkt->shdr.hdr.size -sizeof (*pkt)); +break ; +default : +dev_warn (inst->core->dev,"unknown property id: %x\n" , pkt->property); + } + +out: +complete (&inst->completion); +} +struct iris_hfi_gen1_response_pkt_info {u32 pkt;u32 pkt_sz;
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response · line 736
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +1
-1@@ -657,7 +730,7 @@ static void iris_hfi_gen1_handle_response(struct iris_core *core, void *response }else if (hdr->pkt_type ==HFI_MSG_SESSION_FILL_BUFFER ) {iris_hfi_gen1_session_ftb_done (inst, hdr); }else if (hdr->pkt_type ==HFI_MSG_SESSION_PROPERTY_INFO ) { -complete (&inst->completion); +iris_hfi_gen1_session_property_info (inst, hdr); }else {struct hfi_msg_session_hdr_pkt *shdr;
Regards,
Vikash
Re: [PATCH v5 11/16] media: iris: update buffer requirements based on received info
Quoted 12 lines · Vikash Garodia
Quoted 9 lines · Dmitry Baryshkov
Upon receiving data for
HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTSthe driver should update buffer sizes and counts from the received data. Implement corresponding functionality updating buffers data. This will be used for upcoming support of AR50Lt platforms with Gen1 firmware.Signed-off-by Dmitry Baryshkov <[email protected]>--- .../platform/qcom/iris/iris_hfi_gen1_response.c | 75 +++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)
Quoted 14 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) · line 597
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +11
-0+static void iris_hfi_gen1_session_property_info (struct iris_inst *inst,void *packet) +{ +struct hfi_msg_session_property_info_pkt *pkt = packet; + +if (!pkt->num_properties) { +dev_err (inst->core->dev,"error, no properties\n" ); + goto out; + } + +switch (pkt->property) { +case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS :If i check the venus message parsing logic, it loops through the packet till it hits the case.
It doesn't, see hfi_session_prop_info()
Quoted 20 lines
Here, we are assuming the first packet type, in the pkt to
be the property "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS". There can be multiple properties in the packet, and if "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS" is not the first one, the usecase would break with incorrect buffer sizes.Quoted 14 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +11
-0+iris_hfi_gen1_session_buffer_requirements (inst, pkt->data, + pkt->shdr.hdr.size -sizeof (*pkt)); +break ; +default : +dev_warn (inst->core->dev,"unknown property id: %x\n" , pkt->property); + } + +out: +complete (&inst->completion); +} +struct iris_hfi_gen1_response_pkt_info {u32 pkt;u32 pkt_sz;
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 11/16] media: iris: update buffer requirements based on received info
Quoted 28 lines · Dmitry Baryshkov
Quoted 12 lines · Vikash Garodia
Quoted 9 lines · Dmitry Baryshkov
Upon receiving data for
HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTSthe driver should update buffer sizes and counts from the received data. Implement corresponding functionality updating buffers data. This will be used for upcoming support of AR50Lt platforms with Gen1 firmware.Signed-off-by Dmitry Baryshkov <[email protected]>--- .../platform/qcom/iris/iris_hfi_gen1_response.c | 75 +++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)Quoted 14 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) · line 597
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +11
-0+static void iris_hfi_gen1_session_property_info (struct iris_inst *inst,void *packet) +{ +struct hfi_msg_session_property_info_pkt *pkt = packet; + +if (!pkt->num_properties) { +dev_err (inst->core->dev,"error, no properties\n" ); + goto out; + } + +switch (pkt->property) { +case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS :If i check the venus message parsing logic, it loops through the packet till it hits the case.
Quoted 2 lines
It doesn't, see
hfi_session_prop_info()
I see the loop happens a layer before during msg processing in iris_hfi_gen1_response_handler(). It calls for iris_hfi_gen1_session_property_info() for every packet of session property type, i was wrong in assuming that one property packet would have multiple property types in it.
Logic is fine.
Quoted 6 lines
Quoted 6 lines
Here, we are assuming the first packet type, in the pkt to
be the property "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS". There can be multiple properties in the packet, and if "HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS" is not the first one, the usecase would break with incorrect buffer sizes.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +6
-0+iris_hfi_gen1_session_buffer_requirements (inst, pkt->data, + pkt->shdr.hdr.size -sizeof (*pkt)); +break ; +default : +dev_warn (inst->core->dev,"unknown property id: %x\n" , pkt->property); + }Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) · line 611
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +5
-0+ +out: +complete (&inst->completion); +} +struct iris_hfi_gen1_response_pkt_info {u32 pkt;u32 pkt_sz;
PATCH v5 12/16 media: iris: implement support for the Agatti platform
In reply to Dmitry BaryshkovPort support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
--- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 227 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 6 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 110 ++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 13 ++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 + 7 files changed, 362 insertions(+)
drivers/media/platform/qcom/iris/Makefile +1 -0
@@ -14,6 +14,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_queue.o \ iris_platform_vpu2.o \ iris_platform_vpu3x.o \ + iris_platform_vpu_ar50lt.o \ iris_power.o \ iris_probe.o \ iris_resources.o \
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +227 -0
230 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_platform_common.h +6 -0
@@ -39,6 +39,10 @@ struct iris_inst;#define MAX_HEVC_VBR_LAYER_HP_SLIDING_WINDOW 5#define MAX_HIER_CODING_LAYER_GEN1 6 +#define BITRATE_MAX_AR50LT 100000000 +#define BITRATE_DEFAULT_AR50LT 20000000 +#define MIN_QP_8BIT_AR50LT 0 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,
@@ -51,8 +55,10 @@ enum pipe_type { };extern const struct iris_firmware_data iris_hfi_gen1_data; +extern const struct iris_firmware_data iris_hfi_gen1_ar50lt_data;extern const struct iris_firmware_data iris_hfi_gen2_data; +extern const struct iris_platform_data qcm2290_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +110 -0
110 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_probe.c +4 -0
@@ -356,6 +356,10 @@ static const struct dev_pm_ops iris_pm_ops = { };static const struct of_device_id iris_dt_match[] = { + { + .compatible ="qcom,qcm2290-venus" , + .data = &qcm2290_data, + }, { .compatible ="qcom,qcs8300-iris" , .data = &qcs8300_data,
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +13 -0
@@ -2194,6 +2194,19 @@ u32 iris_vpu4x_buf_size(struct iris_inst *inst, enum iris_buffer_type buffer_typreturn size; } +u32 iris_vpu_ar50lt_gen1_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type) +{ +const struct iris_hfi_session_ops *hfi_ops = inst->hfi_session_ops; +int ret; + +/* return 0 on error to let the driver cope */ + ret = hfi_ops->session_get_property (inst,HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS ); +if (ret) +return 0 ; + +return inst->buffers[buffer_type].size; +} +static u32 internal_buffer_count (struct iris_inst *inst,enum iris_buffer_type buffer_type) {
drivers/media/platform/qcom/iris/iris_vpu_buffer.h +1 -0
@@ -288,6 +288,7 @@ static inline u32 size_av1d_qp(u32 frame_width, u32 frame_height)u32 iris_vpu_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);u32 iris_vpu33_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);u32 iris_vpu4x_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type); +u32 iris_vpu_ar50lt_gen1_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);int iris_vpu_buf_count (struct iris_inst *inst,enum iris_buffer_type buffer_type);#endif
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 12/16] media: iris: implement support for the Agatti platform
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Logic Error: Invalid hardware frequency calculation due to missing `mb_cycles_vsp` parameter…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Logic Error: Invalid hardware frequency calculation due to missing mb_cycles_vsp parameter
- [High] Hardware Configuration: The watchdog interrupt is defined but never unmasked, breaking watchdog recovery
- [Low] Build Failure: Initialization of non-existent struct members in qcm2290_data
--
commit eabd242734902d122adf5442b6b1946c0a61380b
Author: Dmitry Baryshkov <[email protected]>
media: iris: implement support for the Agatti platform
Port support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 75
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +9
-0+static struct platform_inst_caps platform_inst_cap_ar50lt = { + .min_frame_width =128 , + .max_frame_width =1920 , + .min_frame_height =128 , + .max_frame_height =1920 , + .max_mbpf = (1920 *1088 ) /256 , + .mb_cycles_vpp =440 , + .mb_cycles_fw =733003 , + .mb_cycles_fw_vpp =225975 ,
[Severity: High]
Does this code need to initialize .mb_cycles_vsp?
It looks like .mb_cycles_vsp is omitted here, so it will default to 0. If the .calc_freq callback in iris_vpu_ar50lt_ops uses iris_vpu2_calculate_frequency(), that function calculates vsp_freq by multiplying the macroblocks-per-second by caps->mb_cycles_vsp. Because mb_cycles_vsp is 0, the resulting hardware clock frequency might be severely undercalculated, potentially causing performance degradation or hardware timeouts.
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 81
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +6
-0+ .max_frame_rate = 120, + .max_operating_rate = 120, +}; + +const struct iris_platform_data qcm2290_data = { + .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_s6_desc,
[Severity: Low]
Does struct iris_platform_data have a member named firmware_desc_gen1?
It appears that struct iris_platform_data (defined in iris_platform_common.h) only contains a generic firmware_desc member. Using .firmware_desc_gen1 here might result in a compilation error.
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +3
-0+ .vpu_ops = &iris_vpu_ar50lt_ops, + .icc_tbl = iris_icc_info_ar50lt, + .icc_tbl_size = ARRAY_SIZE(iris_icc_info_ar50lt),
[ ... ]
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 103
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +4
-0+ .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_ar50lt), + .num_vpp_pipe = 1, + .no_rpmh = true, + .wd_intr_mask = WRAPPER_INTR_STATUS_A2HWD_BMSK,
[Severity: High]
Will the watchdog interrupt actually be unmasked by the hardware?
This defines the platform's watchdog status bit mask as WRAPPER_INTR_STATUS_A2HWD_BMSK (0x10). However, if iris_vpu_ar50lt_interrupt_init() in iris_vpu_ar50lt.c overwrites WRAPPER_INTR_MASK with a hardcoded mask that omits the watchdog bit, the watchdog interrupt will not be unmasked, preventing the driver from detecting and recovering from VPU firmware hangs.
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +7
-0+ .icc_ib_multiplier = 2, + .max_session_count = 8, + .max_core_mbpf = ((1920 * 1088) / 256) * 4, +/* Concurrency: 1080p@30 decode + 1080p@30 encode */ +/* Concurrency: 3 * 1080p@30 decode */ + .max_core_mbps = (((1920 * 1088) / 256) * 90), +};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
Vikash Garodia
maintainerRe: [PATCH v5 12/16] media: iris: implement support for the Agatti platform
In reply to Dmitry BaryshkovQuoted 306 lines · Dmitry Baryshkov
Port support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
Co-developed-by Dikshita Agarwal <[email protected]>Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 227 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 6 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 110 ++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 13 ++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 + 7 files changed, 362 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -14,6 +14,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_queue.o \ iris_platform_vpu2.o \ iris_platform_vpu3x.o \ + iris_platform_vpu_ar50lt.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_hfi_gen1.c +227
-0@@ -443,3 +443,230 @@ const struct iris_firmware_data iris_hfi_gen1_data = { .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, .enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl), }; + +static const struct platform_inst_fw_cap iris_inst_fw_cap_gen1_ar50lt_dec[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, +}; + +static const struct platform_inst_fw_cap inst_fw_cap_gen1_ar50lt_enc[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, + { + .cap_id =PROFILE_H264 , + .min =V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE , + .max =V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH ), + .value =V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =PROFILE_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE ), + .value =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_H264 , + .min =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1B ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_3 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_2 ), + .value =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .max =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =HEADER_MODE , + .min =V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE , + .max =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE ) | +BIT (V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME ), + .value =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_header_mode_gen1, + }, + { + .cap_id =BITRATE , + .min =BITRATE_MIN , + .max =BITRATE_MAX_AR50LT , + .step_or_mask =BITRATE_STEP , + .value =BITRATE_DEFAULT_AR50LT , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_bitrate_gen1, + }, + { + .cap_id =BITRATE_MODE , + .min =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .max =V4L2_MPEG_VIDEO_BITRATE_MODE_CBR , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_VBR ) | +BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ), + .value =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .hfi_id =HFI_PROPERTY_PARAM_VENC_RATE_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_bitrate_mode_gen1, + }, + { + .cap_id =FRAME_SKIP_MODE , + .min =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .max =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED ) | +BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT ), + .value =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + }, + { + .cap_id =FRAME_RC_ENABLE , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =1 , + }, + { + .cap_id =GOP_SIZE , + .min =0 , + .max = (1 <<16 ) -1 , + .step_or_mask =1 , + .value =30 , + .set = iris_set_u32 + }, + { + .cap_id =ENTROPY_MODE , + .min =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .max =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC ) | +BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC ), + .value =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_entropy_mode_gen1, + }, + { + .cap_id =MIN_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MIN_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MAX_QP_HEVC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, +}; + +static const u32 iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl[] = { +BUF_BIN , +BUF_SCRATCH_1 , +}; + +const struct iris_firmware_data iris_hfi_gen1_ar50lt_data = { + .init_hfi_ops = &iris_hfi_gen1_sys_ops_init, + + .inst_fw_caps_dec = iris_inst_fw_cap_gen1_ar50lt_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (iris_inst_fw_cap_gen1_ar50lt_dec), + .inst_fw_caps_enc = inst_fw_cap_gen1_ar50lt_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_gen1_ar50lt_enc), + + .dec_input_config_params_default = + sm8250_vdec_input_config_param_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8250_vdec_input_config_param_default), + .enc_input_config_params = sm8250_venc_input_config_param, + .enc_input_config_params_size = +ARRAY_SIZE (sm8250_venc_input_config_param), + + .dec_ip_int_buf_tbl = iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8250_dec_op_int_buf_tbl), + + .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8250_enc_ip_int_buf_tbl), +};drivers/media/platform/qcom/iris/iris_platform_common.h +6
-0@@ -39,6 +39,10 @@ struct iris_inst;#define MAX_HEVC_VBR_LAYER_HP_SLIDING_WINDOW 5#define MAX_HIER_CODING_LAYER_GEN1 6 +#define BITRATE_MAX_AR50LT 100000000 +#define BITRATE_DEFAULT_AR50LT 20000000 +#define MIN_QP_8BIT_AR50LT 0 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,@@ -51,8 +55,10 @@ enum pipe_type { };extern const struct iris_firmware_data iris_hfi_gen1_data; +extern const struct iris_firmware_data iris_hfi_gen1_ar50lt_data;extern const struct iris_firmware_data iris_hfi_gen2_data; +extern const struct iris_platform_data qcm2290_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +8
-0@@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include "iris_core.h" +#include "iris_ctrls.h" +#include "iris_hfi_gen2.h"
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 18
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +10
-0+#include "iris_hfi_gen2_defines.h" +#include "iris_platform_common.h" +#include "iris_vpu_buffer.h" +#include "iris_vpu_common.h" + +#define WRAPPER_INTR_STATUS_A2HWD_BMSK 0x10 + +const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen1_s6_desc = { + .firmware_data = &iris_hfi_gen1_ar50lt_data, + .get_vpu_buffer_size = iris_vpu_ar50lt_gen1_buf_size,
unlike gen2, gen1 is calling buffer_requirement from firmware for every buffer types. And given that call is a synchronous call to firmware i.e it calls and wait for a response, i see it can cause delay (and infact not needed) if called for multiple internal buffer types. Can we see if we can call that call once ? That call to firmware (get prop for HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS) fetches requirement for all buffer types.
Regards,
Vikash
Re: [PATCH v5 12/16] media: iris: implement support for the Agatti platform
Quoted 317 lines · Vikash Garodia
Quoted 303 lines · Dmitry Baryshkov
Port support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
Co-developed-by Dikshita Agarwal <[email protected]>Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 227 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 6 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 110 ++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 13 ++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 + 7 files changed, 362 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -14,6 +14,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_queue.o \ iris_platform_vpu2.o \ iris_platform_vpu3x.o \ + iris_platform_vpu_ar50lt.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_hfi_gen1.c +227
-0@@ -443,3 +443,230 @@ const struct iris_firmware_data iris_hfi_gen1_data = { .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, .enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl), }; + +static const struct platform_inst_fw_cap iris_inst_fw_cap_gen1_ar50lt_dec[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, +}; + +static const struct platform_inst_fw_cap inst_fw_cap_gen1_ar50lt_enc[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, + { + .cap_id =PROFILE_H264 , + .min =V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE , + .max =V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH ), + .value =V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =PROFILE_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE ), + .value =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_H264 , + .min =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1B ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_3 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_2 ), + .value =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .max =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =HEADER_MODE , + .min =V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE , + .max =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE ) | +BIT (V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME ), + .value =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_header_mode_gen1, + }, + { + .cap_id =BITRATE , + .min =BITRATE_MIN , + .max =BITRATE_MAX_AR50LT , + .step_or_mask =BITRATE_STEP , + .value =BITRATE_DEFAULT_AR50LT , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_bitrate_gen1, + }, + { + .cap_id =BITRATE_MODE , + .min =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .max =V4L2_MPEG_VIDEO_BITRATE_MODE_CBR , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_VBR ) | +BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ), + .value =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .hfi_id =HFI_PROPERTY_PARAM_VENC_RATE_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_bitrate_mode_gen1, + }, + { + .cap_id =FRAME_SKIP_MODE , + .min =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .max =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED ) | +BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT ), + .value =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + }, + { + .cap_id =FRAME_RC_ENABLE , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =1 , + }, + { + .cap_id =GOP_SIZE , + .min =0 , + .max = (1 <<16 ) -1 , + .step_or_mask =1 , + .value =30 , + .set = iris_set_u32 + }, + { + .cap_id =ENTROPY_MODE , + .min =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .max =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC ) | +BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC ), + .value =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_entropy_mode_gen1, + }, + { + .cap_id =MIN_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MIN_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MAX_QP_HEVC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, +}; + +static const u32 iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl[] = { +BUF_BIN , +BUF_SCRATCH_1 , +}; + +const struct iris_firmware_data iris_hfi_gen1_ar50lt_data = { + .init_hfi_ops = &iris_hfi_gen1_sys_ops_init, + + .inst_fw_caps_dec = iris_inst_fw_cap_gen1_ar50lt_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (iris_inst_fw_cap_gen1_ar50lt_dec), + .inst_fw_caps_enc = inst_fw_cap_gen1_ar50lt_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_gen1_ar50lt_enc), + + .dec_input_config_params_default = + sm8250_vdec_input_config_param_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8250_vdec_input_config_param_default), + .enc_input_config_params = sm8250_venc_input_config_param, + .enc_input_config_params_size = +ARRAY_SIZE (sm8250_venc_input_config_param), + + .dec_ip_int_buf_tbl = iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8250_dec_op_int_buf_tbl), + + .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8250_enc_ip_int_buf_tbl), +};drivers/media/platform/qcom/iris/iris_platform_common.h +6
-0@@ -39,6 +39,10 @@ struct iris_inst;#define MAX_HEVC_VBR_LAYER_HP_SLIDING_WINDOW 5#define MAX_HIER_CODING_LAYER_GEN1 6 +#define BITRATE_MAX_AR50LT 100000000 +#define BITRATE_DEFAULT_AR50LT 20000000 +#define MIN_QP_8BIT_AR50LT 0 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,@@ -51,8 +55,10 @@ enum pipe_type { };extern const struct iris_firmware_data iris_hfi_gen1_data; +extern const struct iris_firmware_data iris_hfi_gen1_ar50lt_data;extern const struct iris_firmware_data iris_hfi_gen2_data; +extern const struct iris_platform_data qcm2290_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +8
-0@@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include "iris_core.h" +#include "iris_ctrls.h" +#include "iris_hfi_gen2.h" drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 18
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +10
-0+#include "iris_hfi_gen2_defines.h" +#include "iris_platform_common.h" +#include "iris_vpu_buffer.h" +#include "iris_vpu_common.h" + +#define WRAPPER_INTR_STATUS_A2HWD_BMSK 0x10 + +const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen1_s6_desc = { + .firmware_data = &iris_hfi_gen1_ar50lt_data, + .get_vpu_buffer_size = iris_vpu_ar50lt_gen1_buf_size,
Quoted 7 lines
unlike gen2, gen1 is calling
buffer_requirementfrom firmware for every buffer types. And given that call is a synchronous call to firmware i.e it calls and wait for a response, i see it can cause delay (and infact not needed) if called for multiple internal buffer types. Can we see if we can call that call once ? That call to firmware (get prop forHFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS) fetches requirement for all buffer types.
This matches the Venus driver, it was querying buffer properties for each packet. If we query buffer sizes only once, what would be the condition to re-query them? One of the property updates? Which ones?
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 12/16] media: iris: implement support for the Agatti platform
Quoted 326 lines · Dmitry Baryshkov
Quoted 317 lines · Vikash Garodia
Quoted 303 lines · Dmitry Baryshkov
Port support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
Co-developed-by Dikshita Agarwal <[email protected]>Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 227 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 6 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 110 ++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 13 ++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 + 7 files changed, 362 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -14,6 +14,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_queue.o \ iris_platform_vpu2.o \ iris_platform_vpu3x.o \ + iris_platform_vpu_ar50lt.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_hfi_gen1.c +227
-0@@ -443,3 +443,230 @@ const struct iris_firmware_data iris_hfi_gen1_data = { .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, .enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl), }; + +static const struct platform_inst_fw_cap iris_inst_fw_cap_gen1_ar50lt_dec[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, +}; + +static const struct platform_inst_fw_cap inst_fw_cap_gen1_ar50lt_enc[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, + { + .cap_id =PROFILE_H264 , + .min =V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE , + .max =V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH ), + .value =V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =PROFILE_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE ), + .value =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_H264 , + .min =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1B ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_3 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_2 ), + .value =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =LEVEL_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .max =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .hfi_id =HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile_level_gen1, + }, + { + .cap_id =HEADER_MODE , + .min =V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE , + .max =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE ) | +BIT (V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME ), + .value =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_header_mode_gen1, + }, + { + .cap_id =BITRATE , + .min =BITRATE_MIN , + .max =BITRATE_MAX_AR50LT , + .step_or_mask =BITRATE_STEP , + .value =BITRATE_DEFAULT_AR50LT , + .hfi_id =HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_bitrate_gen1, + }, + { + .cap_id =BITRATE_MODE , + .min =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .max =V4L2_MPEG_VIDEO_BITRATE_MODE_CBR , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_VBR ) | +BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ), + .value =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .hfi_id =HFI_PROPERTY_PARAM_VENC_RATE_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_bitrate_mode_gen1, + }, + { + .cap_id =FRAME_SKIP_MODE , + .min =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .max =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED ) | +BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT ), + .value =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + }, + { + .cap_id =FRAME_RC_ENABLE , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =1 , + }, + { + .cap_id =GOP_SIZE , + .min =0 , + .max = (1 <<16 ) -1 , + .step_or_mask =1 , + .value =30 , + .set = iris_set_u32 + }, + { + .cap_id =ENTROPY_MODE , + .min =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .max =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC ) | +BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC ), + .value =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_entropy_mode_gen1, + }, + { + .cap_id =MIN_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MIN_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, + { + .cap_id =MAX_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP_HEVC , + .step_or_mask =1 , + .value =MAX_QP_HEVC , + .hfi_id =HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_qp_range, + }, +}; + +static const u32 iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl[] = { +BUF_BIN , +BUF_SCRATCH_1 , +}; + +const struct iris_firmware_data iris_hfi_gen1_ar50lt_data = { + .init_hfi_ops = &iris_hfi_gen1_sys_ops_init, + + .inst_fw_caps_dec = iris_inst_fw_cap_gen1_ar50lt_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (iris_inst_fw_cap_gen1_ar50lt_dec), + .inst_fw_caps_enc = inst_fw_cap_gen1_ar50lt_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_gen1_ar50lt_enc), + + .dec_input_config_params_default = + sm8250_vdec_input_config_param_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8250_vdec_input_config_param_default), + .enc_input_config_params = sm8250_venc_input_config_param, + .enc_input_config_params_size = +ARRAY_SIZE (sm8250_venc_input_config_param), + + .dec_ip_int_buf_tbl = iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8250_dec_op_int_buf_tbl), + + .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8250_enc_ip_int_buf_tbl), +};drivers/media/platform/qcom/iris/iris_platform_common.h +6
-0@@ -39,6 +39,10 @@ struct iris_inst;#define MAX_HEVC_VBR_LAYER_HP_SLIDING_WINDOW 5#define MAX_HIER_CODING_LAYER_GEN1 6 +#define BITRATE_MAX_AR50LT 100000000 +#define BITRATE_DEFAULT_AR50LT 20000000 +#define MIN_QP_8BIT_AR50LT 0 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,@@ -51,8 +55,10 @@ enum pipe_type { };extern const struct iris_firmware_data iris_hfi_gen1_data; +extern const struct iris_firmware_data iris_hfi_gen1_ar50lt_data;extern const struct iris_firmware_data iris_hfi_gen2_data; +extern const struct iris_platform_data qcm2290_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +8
-0@@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include "iris_core.h" +#include "iris_ctrls.h" +#include "iris_hfi_gen2.h" drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c line 18
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c new file +10
-0+#include "iris_hfi_gen2_defines.h" +#include "iris_platform_common.h" +#include "iris_vpu_buffer.h" +#include "iris_vpu_common.h" + +#define WRAPPER_INTR_STATUS_A2HWD_BMSK 0x10 + +const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen1_s6_desc = { + .firmware_data = &iris_hfi_gen1_ar50lt_data, + .get_vpu_buffer_size = iris_vpu_ar50lt_gen1_buf_size,Quoted 7 lines
unlike gen2, gen1 is calling
buffer_requirementfrom firmware for every buffer types. And given that call is a synchronous call to firmware i.e it calls and wait for a response, i see it can cause delay (and infact not needed) if called for multiple internal buffer types. Can we see if we can call that call once ? That call to firmware (get prop forHFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS) fetches requirement for all buffer types.
Quoted 4 lines
This matches the Venus driver, it was querying buffer properties for each packet. If we query buffer sizes only once, what would be the condition to re-query them? One of the property updates? Which ones?
Was trying to find the downstream design for this, and could find this here [1]. Moreover, if you see the property queried to firmware, it does not carry the buffer type with it, its the one call for all buffer types. I will leave the implementation upto you, if there are multiple buffers being queried, those can be combined into a single call to avoid waiting on every call.
Venus is doing the inefficient way too.
[1] https://github.com/ianmacd/winnerx/blob/master/drivers/media/platform/msm/vidc/msm_vidc.c#L1178
Regards,
Vikash
Vikash Garodia
maintainerRe: [PATCH v5 12/16] media: iris: implement support for the Agatti platform
In reply to Dmitry BaryshkovQuoted 52 lines · Dmitry Baryshkov
Port support for the AR50Lt video codec core (present for example on the Agatti platform) to the Iris driver. Unlike more recent cores this generation doesn't have the PIPE property (as it always has only one pipe). Also, unlike newer platforms, buffer sizes are requested from the firmware instead of being calculated by the driver.
Co-developed-by Dikshita Agarwal <[email protected]>Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 227 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 6 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 110 ++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 13 ++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 + 7 files changed, 362 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -14,6 +14,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_queue.o \ iris_platform_vpu2.o \ iris_platform_vpu3x.o \ + iris_platform_vpu_ar50lt.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_hfi_gen1.c +13
-0@@ -443,3 +443,230 @@ const struct iris_firmware_data iris_hfi_gen1_data = { .enc_ip_int_buf_tbl = sm8250_enc_ip_int_buf_tbl, .enc_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_enc_ip_int_buf_tbl), }; + +static const struct platform_inst_fw_cap iris_inst_fw_cap_gen1_ar50lt_dec[] = { + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROPERTY_PARAM_WORK_MODE , + .set = iris_set_stage, + }, +}; +
<snip>
drivers/media/platform/qcom/iris/iris_hfi_gen1.c const struct iris_firmware_data iris_hfi_gen1_data = { · line 644
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +2
-0+ +static const u32 iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl[] = {
gen1...
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +12
-0+BUF_BIN , + BUF_SCRATCH_1, +}; + +const struct iris_firmware_data iris_hfi_gen1_ar50lt_data = { + .init_hfi_ops = &iris_hfi_gen1_sys_ops_init, + + .inst_fw_caps_dec = iris_inst_fw_cap_gen1_ar50lt_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (iris_inst_fw_cap_gen1_ar50lt_dec), + .inst_fw_caps_enc = inst_fw_cap_gen1_ar50lt_enc, + .inst_fw_caps_enc_size = ARRAY_SIZE(inst_fw_cap_gen1_ar50lt_enc), +
drivers/media/platform/qcom/iris/iris_hfi_gen1.c const struct iris_firmware_data iris_hfi_gen1_data = { · line 666
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +10
-0+ .dec_input_config_params_default = + sm8250_vdec_input_config_param_default, + .dec_input_config_params_default_size = + ARRAY_SIZE(sm8250_vdec_input_config_param_default), + .enc_input_config_params = sm8250_venc_input_config_param, + .enc_input_config_params_size = + ARRAY_SIZE(sm8250_venc_input_config_param), + + .dec_ip_int_buf_tbl = iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size = ARRAY_SIZE(iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl),
same here
drivers/media/platform/qcom/iris/iris_hfi_gen1.c const struct iris_firmware_data iris_hfi_gen1_data = { · line 669
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +3
-0+ .dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size = ARRAY_SIZE(sm8250_dec_op_int_buf_tbl), +
Regards,
Vikash
PATCH v5 13/16 media: iris: Introduce buffer size calculations for AR50LT
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
--- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 401 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 37 ++ 2 files changed, 438 insertions(+)
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +401 -0
@@ -50,6 +50,32 @@ static u32 hfi_buffer_bin_h264d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h264d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h264d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <=1920 *1088 *3 /2 ) { + size_bin_hdr = size_yuv *H264_CABAC_HDR_RATIO_SM_TOT ; + size_bin_res = size_yuv *H264_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *3 ) /5 ; + size_bin_res = (size_yuv *3 ) /2 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +} + +static u32 hfi_buffer_bin_h264d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 n_aligned_h =ALIGN (frame_height,16 ); +u32 n_aligned_w =ALIGN (frame_width,16 ); + +return size_h264d_hw_bin_buffer_ar50lt (n_aligned_w, n_aligned_h, num_vpp_pipes); +} +static u32 size_av1d_hw_bin_buffer (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 size_yuv, size_bin_hdr, size_bin_res;
@@ -103,6 +129,21 @@ static u32 hfi_buffer_bin_vp9d(u32 frame_width, u32 frame_height, u32 num_vpp_pireturn _size * num_vpp_pipes; } +static u32 hfi_buffer_bin_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size; + + size_yuv =ALIGN (frame_width,16 ) *ALIGN (frame_height,16 ) *3 /2 ; + size_yuv =ALIGN (size_yuv,DMA_ALIGNMENT ); + + size =ALIGN (((((MAX (size_yuv,VPX_DECODER_FRAME_BIN_BUFFER_SIZE )) *6 ) /5 ) / + num_vpp_pipes),DMA_ALIGNMENT ) + +ALIGN ((((MAX (size_yuv,VPX_DECODER_FRAME_BIN_BUFFER_SIZE )) *4 ) / num_vpp_pipes), +DMA_ALIGNMENT ); + +return size * num_vpp_pipes; +} +static u32 hfi_buffer_bin_h265d (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 n_aligned_w =ALIGN (frame_width,16 );
@@ -111,6 +152,32 @@ static u32 hfi_buffer_bin_h265d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h265d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h265d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <= ((BIN_BUFFER_THRESHOLD *3 ) >>1 )) { + size_bin_hdr = size_yuv *H265_CABAC_HDR_RATIO_SM_TOT ; + size_bin_res = size_yuv *H265_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *41 ) /50 ; + size_bin_res = (size_yuv *59 ) /50 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +} + +static u32 hfi_buffer_bin_h265d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 n_aligned_w =ALIGN (frame_width,16 ); +u32 n_aligned_h =ALIGN (frame_height,16 ); + +return size_h265d_hw_bin_buffer_ar50lt (n_aligned_w, n_aligned_h, num_vpp_pipes); +} +static u32 hfi_buffer_comv_h264d (u32 frame_width,u32 frame_height,u32 _comv_bufcount) {u32 frame_height_in_mbs =DIV_ROUND_UP (frame_height,16 );
@@ -174,6 +241,14 @@ static u32 size_h264d_bse_cmd_buf(u32 frame_height)SIZE_H264D_BSE_CMD_PER_BUF ; } +static u32 size_h264d_bse_cmd_buf_ar50lt (u32 frame_height) +{ +u32 height =ALIGN (frame_height,32 ); + +return min_t (u32, (DIV_ROUND_UP (height,16 ) *12 ),H264D_MAX_SLICE ) * +SIZE_H264D_BSE_CMD_PER_BUF ; +} +static u32 size_h265d_bse_cmd_buf (u32 frame_width,u32 frame_height) { u32 _size = ALIGN(((ALIGN(frame_width, LCU_MAX_SIZE_PELS) / LCU_MIN_SIZE_PELS) *
@@ -185,6 +260,18 @@ static u32 size_h265d_bse_cmd_buf(u32 frame_width, u32 frame_height)return _size; } +static u32 size_h265d_bse_cmd_buf_ar50lt (u32 frame_width,u32 frame_height) +{ +u32 _size =ALIGN (((ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS )) * +NUM_HW_PIC_BUF ,DMA_ALIGNMENT ); + + _size =min_t (u32, _size,H265D_MAX_SLICE_AR50LT +1 ); + _size =2 * _size *SIZE_H265D_BSE_CMD_PER_BUF ; + +return _size; +} +static u32 hfi_buffer_persist_h265d (u32 rpu_enabled) { return ALIGN((SIZE_SLIST_BUF_H265 * NUM_SLIST_BUF_H265 +
@@ -195,6 +282,13 @@ static u32 hfi_buffer_persist_h265d(u32 rpu_enabled) DMA_ALIGNMENT); } +static u32 hfi_buffer_persist_h265d_ar50lt (void ) +{ +return ALIGN ((SIZE_SLIST_BUF_H265 *NUM_SLIST_BUF_H265 + +H265_NUM_TILE *sizeof (u32) +NUM_HW_PIC_BUF *SIZE_SEI_USERDATA ), +DMA_ALIGNMENT ); +} +static inline u32 hfi_iris3_vp9d_comv_size (void ) {
@@ -212,6 +306,13 @@ static u32 hfi_buffer_persist_vp9d(void)HDR10_HIST_EXTRADATA_SIZE ; } +static u32 hfi_buffer_persist_vp9d_ar50lt (void ) +{ +return ALIGN (VP9_NUM_PROBABILITY_TABLE_BUF *VP9_PROB_TABLE_SIZE ,DMA_ALIGNMENT ) + +ALIGN (hfi_iris3_vp9d_comv_size (),DMA_ALIGNMENT ) + +ALIGN (MAX_SUPERFRAME_HEADER_LEN ,DMA_ALIGNMENT ); +} +static u32 size_h264d_vpp_cmd_buf (u32 frame_height) {u32 size, height =ALIGN (frame_height,32 );
@@ -222,6 +323,16 @@ static u32 size_h264d_vpp_cmd_buf(u32 frame_height)return size >VPP_CMD_MAX_SIZE ?VPP_CMD_MAX_SIZE : size; } +static u32 size_h264d_vpp_cmd_buf_ar50lt (u32 frame_height) +{ +u32 size, height =ALIGN (frame_height,32 ); + + size =min_t (u32, (DIV_ROUND_UP (height,16 ) *12 ),H264D_MAX_SLICE ) * +SIZE_H264D_VPP_CMD_PER_BUF ; + +return size >VPP_CMD_MAX_SIZE ?VPP_CMD_MAX_SIZE : size; +} +static u32 hfi_buffer_persist_h264d (void ) { return ALIGN(SIZE_SLIST_BUF_H264 * NUM_SLIST_BUF_H264 +
@@ -230,6 +341,11 @@ static u32 hfi_buffer_persist_h264d(void) DMA_ALIGNMENT); } +static u32 hfi_buffer_persist_h264d_ar50lt (void ) +{ +return ALIGN ((SIZE_SLIST_BUF_H264 *NUM_SLIST_BUF_H264 ),DMA_ALIGNMENT ); +} +static u32 hfi_buffer_persist_av1d (u32 max_width,u32 max_height,u32 total_ref_count) {u32 comv_size, size;
@@ -255,6 +371,17 @@ static u32 hfi_buffer_non_comv_h264d(u32 frame_width, u32 frame_height, u32 num_return ALIGN (size,DMA_ALIGNMENT ); } +static u32 hfi_buffer_non_comv_h264d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_bse =size_h264d_bse_cmd_buf_ar50lt (frame_height); +u32 size_vpp =size_h264d_vpp_cmd_buf_ar50lt (frame_height); +u32 size =ALIGN (size_bse,DMA_ALIGNMENT ) + +ALIGN (size_vpp,DMA_ALIGNMENT ) + +ALIGN (SIZE_HW_PIC (SIZE_H264D_HW_PIC_T ),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static u32 size_h265d_vpp_cmd_buf (u32 frame_width,u32 frame_height) { u32 _size = ALIGN(((ALIGN(frame_width, LCU_MAX_SIZE_PELS) / LCU_MIN_SIZE_PELS) *
@@ -269,6 +396,20 @@ static u32 size_h265d_vpp_cmd_buf(u32 frame_width, u32 frame_height)return _size; } +static u32 size_h265d_vpp_cmd_buf_ar50lt (u32 frame_width,u32 frame_height) +{ +u32 _size =ALIGN (((ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS )) * +NUM_HW_PIC_BUF ,DMA_ALIGNMENT ); + _size =min_t (u32, _size,H265D_MAX_SLICE_AR50LT +1 ); + _size =ALIGN (_size,4 ); + _size =2 * _size *SIZE_H265D_VPP_CMD_PER_BUF_AR50LT ; +if (_size >VPP_CMD_MAX_SIZE ) + _size =VPP_CMD_MAX_SIZE ; + +return _size; +} +static u32 hfi_buffer_non_comv_h265d (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 _size_bse =size_h265d_bse_cmd_buf (frame_width, frame_height);
@@ -285,6 +426,20 @@ static u32 hfi_buffer_non_comv_h265d(u32 frame_width, u32 frame_height, u32 num_return ALIGN (_size,DMA_ALIGNMENT ); } +static u32 hfi_buffer_non_comv_h265d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 _size_bse =size_h265d_bse_cmd_buf_ar50lt (frame_width, frame_height); +u32 _size_vpp =size_h265d_vpp_cmd_buf_ar50lt (frame_width, frame_height); +u32 _size =ALIGN (_size_bse,DMA_ALIGNMENT ) + +ALIGN (_size_vpp,DMA_ALIGNMENT ) + +ALIGN (2 *sizeof (u16) * + (ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ),DMA_ALIGNMENT ) + +ALIGN (SIZE_HW_PIC (SIZE_H265D_HW_PIC_T ),DMA_ALIGNMENT ); + +return ALIGN (_size,DMA_ALIGNMENT ); +} +static u32 size_vpss_lb (u32 frame_width,u32 frame_height) {u32 opb_lb_wr_llb_y_buffer_size, opb_lb_wr_llb_uv_buffer_size;
@@ -317,6 +472,13 @@ u32 size_h265d_lb_fe_top_data(u32 frame_width, u32 frame_height) (ALIGN (frame_width,64 ) +8 ) *2 ; } +static inline +u32 size_h265d_lb_fe_top_data_ar50lt (u32 frame_width,u32 frame_height) +{ +return ALIGN (MAX_FE_NBR_DATA_LUMA_LINE_BUFFER_SIZE * + (ALIGN (frame_width,64 ) +8 ),DMA_ALIGNMENT ) *2 ; +} +static inline u32 size_h265d_lb_fe_top_ctrl (u32 frame_width,u32 frame_height) {
@@ -348,6 +510,17 @@ u32 size_h265d_lb_se_left_ctrl(u32 frame_width, u32 frame_height) MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE)); } +static inline +u32 size_h265d_lb_se_left_ctrl_ar50lt (u32 frame_width,u32 frame_height) +{ +return max_t (u32, ((frame_height +16 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE_AR50LT , +max_t (u32, ((frame_height +32 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE_AR50LT , + ((frame_height +64 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT )); +} +static inline u32 size_h265d_lb_pe_top_data (u32 frame_width,u32 frame_height) {
@@ -355,6 +528,13 @@ u32 size_h265d_lb_pe_top_data(u32 frame_width, u32 frame_height) (ALIGN (frame_width,LCU_MIN_SIZE_PELS ) /LCU_MIN_SIZE_PELS ); } +static inline +u32 size_h265d_lb_pe_top_data_ar50lt (u32 frame_width,u32 frame_height) +{ +return MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE_AR50LT * + (ALIGN (frame_width,LCU_MIN_SIZE_PELS ) /LCU_MIN_SIZE_PELS ); +} +static inline u32 size_h265d_lb_vsp_top (u32 frame_width,u32 frame_height) {
@@ -404,6 +584,29 @@ u32 hfi_buffer_line_h265d(u32 frame_width, u32 frame_height, bool is_opb, u32 nureturn ALIGN ((_size + vpss_lb_size),DMA_ALIGNMENT ); } +static inline +u32 hfi_buffer_line_h265d_ar50lt (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h265d_lb_fe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_left_ctrl (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_se_left_ctrl_ar50lt (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_se_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_pe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_left (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_recon_dma_metadata_wr (frame_width, frame_height), +DMA_ALIGNMENT ) *4 + +ALIGN (size_h265d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static inline u32 size_vpxd_lb_fe_left_ctrl (u32 frame_width,u32 frame_height) {
@@ -438,6 +641,17 @@ u32 size_vpxd_lb_se_left_ctrl(u32 frame_width, u32 frame_height) MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE)); } +static inline +u32 size_vpxd_lb_se_left_ctrl_ar50lt (u32 frame_width,u32 frame_height) +{ +return max_t (u32, ((frame_height +15 ) >>4 ) * +MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE_AR50LT , +max_t (u32, ((frame_height +31 ) >>5 ) * +MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE_AR50LT , + ((frame_height +63 ) >>6 ) * +MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT )); +} +static inline u32 size_vpxd_lb_recon_dma_metadata_wr (u32 frame_width,u32 frame_height) {
@@ -492,6 +706,19 @@ u32 hfi_iris3_vp9d_lb_size(u32 frame_width, u32 frame_height, u32 num_vpp_pipes)ALIGN (size_vp9d_qp (frame_width, frame_height),DMA_ALIGNMENT ); } +static inline +u32 hfi_ar50lt_vp9d_lb_size (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +return ALIGN (size_vpxd_lb_fe_left_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vpxd_lb_se_left_ctrl_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vp9d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vpxd_lb_se_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_pe_top_data (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_fe_top_data (frame_width, frame_height),DMA_ALIGNMENT ); +} +static inline u32 hfi_buffer_line_vp9d (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min,bool is_opb,u32 num_vpp_pipes)
@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes); +} +static u32 hfi_buffer_line_h264d (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) {
@@ -529,6 +763,25 @@ static u32 hfi_buffer_line_h264d(u32 frame_width, u32 frame_height,return ALIGN ((size + vpss_lb_size),DMA_ALIGNMENT ); } +static u32 hfi_buffer_line_h264d_ar50lt (u32 frame_width,u32 frame_height, +bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h264d_lb_fe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_fe_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_fe_left_ctrl (frame_height),DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h264d_lb_se_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_se_left_ctrl_ar50lt (frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_h264d_lb_pe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_vsp_top (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_recon_dma_metadata_wr (frame_height),DMA_ALIGNMENT ) *2 + +ALIGN (size_h264d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static u32 size_av1d_lb_opb_wr1_nv12_ubwc (u32 frame_width,u32 frame_height) {u32 size, y_width, y_width_a =128 ;
@@ -724,6 +977,23 @@ static u32 iris_vpu_dec_bin_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_bin_size (struct iris_inst *inst) +{ +u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe; +struct v4l2_format *f = inst->fmt_src; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; + +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_bin_h264d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_bin_h265d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_VP9 ) +return hfi_buffer_bin_vp9d_ar50lt (width, height, num_vpp_pipes); + +return 0 ; +} +static u32 iris_vpu_dec_comv_size (struct iris_inst *inst) {u32 num_comv =VIDEO_MAX_FRAME ;
@@ -785,6 +1055,18 @@ static u32 iris_vpu_dec_persist_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_persist_size (struct iris_inst *inst) +{ +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_persist_h264d_ar50lt (); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_persist_h265d_ar50lt (); +else if (inst->codec ==V4L2_PIX_FMT_VP9 ) +return hfi_buffer_persist_vp9d_ar50lt (); + +return 0 ; +} +static u32 iris_vpu_dec_dpb_size (struct iris_inst *inst) {if (iris_split_mode_enabled (inst))
@@ -808,6 +1090,21 @@ static u32 iris_vpu_dec_non_comv_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_non_comv_size (struct iris_inst *inst) +{ +u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe; +struct v4l2_format *f = inst->fmt_src; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; + +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_non_comv_h264d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_non_comv_h265d_ar50lt (width, height, num_vpp_pipes); + +return 0 ; +} +static u32 iris_vpu_dec_line_size (struct iris_inst *inst) {u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe;
@@ -833,6 +1130,29 @@ static u32 iris_vpu_dec_line_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_line_size (struct iris_inst *inst) +{ +u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe; +struct v4l2_format *f = inst->fmt_src; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; +bool is_opb = false; +u32 out_min_count = inst->buffers[BUF_OUTPUT ].min_count; + +if (iris_split_mode_enabled (inst)) + is_opb = true; + +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_line_h264d_ar50lt (width, height, is_opb, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_line_h265d_ar50lt (width, height, is_opb, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_VP9 ) +return hfi_buffer_line_vp9d_ar50lt (width, height, out_min_count, is_opb, + num_vpp_pipes); + +return 0 ; +} +static u32 iris_vpu_dec_scratch1_size (struct iris_inst *inst) { return iris_vpu_dec_comv_size(inst) +
@@ -840,6 +1160,13 @@ static u32 iris_vpu_dec_scratch1_size(struct iris_inst *inst)iris_vpu_dec_line_size (inst); } +static u32 iris_vpu_ar50lt_dec_scratch1_size (struct iris_inst *inst) +{ +return iris_vpu_dec_comv_size (inst) + +iris_vpu_ar50lt_dec_non_comv_size (inst) + +iris_vpu_ar50lt_dec_line_size (inst); +} +static inline u32 iris_vpu_enc_get_bitstream_width (struct iris_inst *inst) {if (is_rotation_90_or_270 (inst))
@@ -1470,6 +1797,15 @@ u32 hfi_buffer_dpb_enc(u32 frame_width, u32 frame_height, bool is_ten_bit)return size; } +static inline +u32 hfi_buffer_dpb_enc_ar50lt (u32 frame_width,u32 frame_height,bool is_ten_bit) +{ +if (!is_ten_bit) +return size_enc_ref_buffer (frame_width, frame_height); +else +return size_enc_ten_bit_ref_buffer (frame_width, frame_height); +} +static u32 iris_vpu_enc_arp_size (struct iris_inst *inst) {return HFI_BUFFER_ARP_ENC ;
@@ -1494,6 +1830,16 @@ u32 hfi_buffer_vpss_enc(u32 dswidth, u32 dsheight, bool ds_enable,return 0 ; } +static inline +u32 hfi_buffer_vpss_enc_ar50lt (u32 dswidth,u32 dsheight,bool ds_enable, +u32 blur,bool is_ten_bit) +{ +if (ds_enable || blur) +return hfi_buffer_dpb_enc_ar50lt (dswidth, dsheight, is_ten_bit); + +return 0 ; +} + static inline u32 hfi_buffer_scratch1_enc(u32 frame_width, u32 frame_height, u32 lcu_size, u32 num_ref, bool ten_bit, u32 num_vpp_pipes,
@@ -1752,6 +2098,16 @@ static u32 iris_vpu_enc_vpss_size(struct iris_inst *inst)return hfi_buffer_vpss_enc (width, height, ds_enable,0 ,0 ); } +static u32 iris_vpu_ar50lt_enc_vpss_size (struct iris_inst *inst) +{ +u32 ds_enable =is_scaling_enabled (inst); +struct v4l2_format *f = inst->fmt_dst; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; + +return hfi_buffer_vpss_enc_ar50lt (width, height, ds_enable,0 ,0 ); +} +static inline u32 size_dpb_opb (u32 height,u32 lcu_size) {u32 max_tile_height = ((height + lcu_size -1 ) / lcu_size) * lcu_size +8 ;
@@ -2207,6 +2563,51 @@ u32 iris_vpu_ar50lt_gen1_buf_size(struct iris_inst *inst, enum iris_buffer_typereturn inst->buffers[buffer_type].size; } +u32 iris_vpu_ar50lt_gen2_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type) +{ +const struct iris_vpu_buf_type_handle *buf_type_handle_arr =NULL ; +u32 size =0 , buf_type_handle_size =0 , i; + +static const struct iris_vpu_buf_type_handle dec_internal_buf_type_handle[] = { + {BUF_BIN , iris_vpu_ar50lt_dec_bin_size }, + {BUF_COMV , iris_vpu_dec_comv_size }, + {BUF_NON_COMV , iris_vpu_ar50lt_dec_non_comv_size }, + {BUF_LINE , iris_vpu_ar50lt_dec_line_size }, + {BUF_PERSIST , iris_vpu_ar50lt_dec_persist_size }, + {BUF_DPB , iris_vpu_dec_dpb_size }, + {BUF_SCRATCH_1 , iris_vpu_ar50lt_dec_scratch1_size }, + {BUF_PARTIAL , iris_vpu_dec_partial_size }, + }; + +static const struct iris_vpu_buf_type_handle enc_internal_buf_type_handle[] = { + {BUF_BIN , iris_vpu_enc_bin_size }, + {BUF_COMV , iris_vpu_enc_comv_size }, + {BUF_NON_COMV , iris_vpu_enc_non_comv_size }, + {BUF_LINE , iris_vpu_enc_line_size }, + {BUF_ARP , iris_vpu_enc_arp_size }, + {BUF_VPSS , iris_vpu_ar50lt_enc_vpss_size }, + {BUF_SCRATCH_1 , iris_vpu_enc_scratch1_size }, + {BUF_SCRATCH_2 , iris_vpu_enc_scratch2_size }, + }; + +if (inst->domain ==DECODER ) { + buf_type_handle_size =ARRAY_SIZE (dec_internal_buf_type_handle); + buf_type_handle_arr = dec_internal_buf_type_handle; + }else if (inst->domain ==ENCODER ) { + buf_type_handle_size =ARRAY_SIZE (enc_internal_buf_type_handle); + buf_type_handle_arr = enc_internal_buf_type_handle; + } + +for (i =0 ; i < buf_type_handle_size; i++) { +if (buf_type_handle_arr[i].type == buffer_type) { + size = buf_type_handle_arr[i].handle (inst); +break ; + } + } + +return size; +} +static u32 internal_buffer_count (struct iris_inst *inst,enum iris_buffer_type buffer_type) {
drivers/media/platform/qcom/iris/iris_vpu_buffer.h +37 -0
@@ -61,17 +61,26 @@ struct iris_inst;#define MAX_FE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE 64#define MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE (128 / 8)#define MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE (128 / 8) +#define MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE_AR50LT (8 / 8) +#define MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE_AR50LT (16 / 8) +#define MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT (32 / 8)#define VP9_UDC_HEADER_BUF_SIZE (3 * 128)#define SIZE_SEI_USERDATA 4096#define SIZE_DOLBY_RPU_METADATA (41 * 1024)#define H264_CABAC_HDR_RATIO_HD_TOT 1#define H264_CABAC_RES_RATIO_HD_TOT 3 +#define H264_CABAC_HDR_RATIO_SM_TOT 1 +#define H264_CABAC_RES_RATIO_SM_TOT 2#define H265D_MAX_SLICE 3600 +#define H265D_MAX_SLICE_AR50LT 600#define SIZE_H265D_HW_PIC_T SIZE_H264D_HW_PIC_T#define H265_CABAC_HDR_RATIO_HD_TOT 2#define H265_CABAC_RES_RATIO_HD_TOT 2 +#define H265_CABAC_HDR_RATIO_SM_TOT 1 +#define H265_CABAC_RES_RATIO_SM_TOT 6#define SIZE_H265D_VPP_CMD_PER_BUF (256) +#define SIZE_H265D_VPP_CMD_PER_BUF_AR50LT (192)#define SIZE_THREE_DIMENSION_USERDATA 768#define SIZE_H265D_ARP 9728
@@ -81,6 +90,7 @@ struct iris_inst;#define VPX_DECODER_FRAME_BIN_DENOMINATOR 2#define VPX_DECODER_FRAME_BIN_RES_BUDGET_RATIO (3 / 2) +#define VPX_DECODER_FRAME_BIN_BUFFER_SIZE (1024 * 1024)#define SIZE_H264D_HW_PIC_T (BIT(11))
@@ -99,6 +109,7 @@ struct iris_inst;#define MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE 64#define MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE 16#define MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE 384 +#define MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE_AR50LT 176#define MAX_FE_NBR_DATA_LUMA_LINE_BUFFER_SIZE 640#define AV1_CABAC_HDR_RATIO_HD_TOT 2
@@ -155,11 +166,21 @@ static inline u32 size_h264d_lb_fe_top_data(u32 frame_width)return MAX_FE_NBR_DATA_LUMA_LINE_BUFFER_SIZE *ALIGN (frame_width,16 ) *3 ; } +static inline u32 size_h264d_lb_fe_top_data_ar50lt (u32 frame_width) +{ +return 16 *ALIGN (frame_width,16 ) *2 ; +} +static inline u32 size_h264d_lb_fe_top_ctrl (u32 frame_width) {return MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE *DIV_ROUND_UP (frame_width,16 ); } +static inline u32 size_h264d_lb_fe_top_ctrl_ar50lt (u32 frame_width) +{ +return 16 *DIV_ROUND_UP (frame_width,16 ); +} +static inline u32 size_h264d_lb_fe_left_ctrl (u32 frame_height) {return MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE *DIV_ROUND_UP (frame_height,16 );
@@ -170,16 +191,31 @@ static inline u32 size_h264d_lb_se_top_ctrl(u32 frame_width)return MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE *DIV_ROUND_UP (frame_width,16 ); } +static inline u32 size_h264d_lb_se_top_ctrl_ar50lt (u32 frame_width) +{ +return MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT *DIV_ROUND_UP (frame_width,16 ); +} +static inline u32 size_h264d_lb_se_left_ctrl (u32 frame_height) {return MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE *DIV_ROUND_UP (frame_height,16 ); } +static inline u32 size_h264d_lb_se_left_ctrl_ar50lt (u32 frame_height) +{ +return MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT *DIV_ROUND_UP (frame_height,16 ); +} +static inline u32 size_h264d_lb_pe_top_data (u32 frame_width) {return MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE *DIV_ROUND_UP (frame_width,16 ); } +static inline u32 size_h264d_lb_pe_top_data_ar50lt (u32 frame_width) +{ +return 64 *DIV_ROUND_UP (frame_width,16 ); +} +static inline u32 size_h264d_lb_vsp_top (u32 frame_width) {return (DIV_ROUND_UP (frame_width,16 ) <<7 );
@@ -289,6 +325,7 @@ u32 iris_vpu_buf_size(struct iris_inst *inst, enum iris_buffer_type buffer_type)u32 iris_vpu33_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);u32 iris_vpu4x_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);u32 iris_vpu_ar50lt_gen1_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type); +u32 iris_vpu_ar50lt_gen2_buf_size (struct iris_inst *inst,enum iris_buffer_type buffer_type);int iris_vpu_buf_count (struct iris_inst *inst,enum iris_buffer_type buffer_type);#endif
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] The AR50LT decoder line buffer size calculations accept an `is_opb` parameter but completely…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] The AR50LT decoder line buffer size calculations accept an is_opb parameter but completely ignore it, failing to allocate memory for the VPSS line buffer when OPB (split mode) is enabled.
- [High] The AR50LT BIN buffer size calculations for H.264 and HEVC ignore num_vpp_pipes, preventing proper buffer partitioning and alignment across hardware pipelines.
- [High] The VP9 AR50LT line buffer calculation omits critical component sizes for DMA metadata and QP maps.
- [High] Missing SEI user data allocation in the H.264 AR50LT persist buffer calculation.
--
commit 41b73900b6c3face3194c0a45272d5dc37396dab
Author: Dikshita Agarwal <[email protected]>
media: iris: Introduce buffer size calculations for AR50LT
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +7
-0@@ -50,6 +50,32 @@ static u32 hfi_buffer_bin_h264d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h264d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h264d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <=1920 *1088 *3 /2 ) { + size_bin_hdr = size_yuv *H264_CABAC_HDR_RATIO_SM_TOT ;
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 hfi_buffer_bin_h264d(u32 frame_width, u32 frame_height, u32 num_vpp_p · line 69
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +10
-0+ size_bin_res = size_yuv *H264_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *3 ) /5 ; + size_bin_res = (size_yuv *3 ) /2 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +}
[Severity: High]
Will this cause incorrect buffer sizing when multiple VPP pipelines are active? The num_vpp_pipes argument is accepted but doesn't seem to be used to partition and align the buffer components like it is in the generic size_h264d_hw_bin_buffer() calculation.
[ ... ]
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +7
-0@@ -111,6 +152,32 @@ static u32 hfi_buffer_bin_h265d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h265d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h265d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <= ((BIN_BUFFER_THRESHOLD *3 ) >>1 )) { + size_bin_hdr = size_yuv *H265_CABAC_HDR_RATIO_SM_TOT ;
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 hfi_buffer_bin_h265d(u32 frame_width, u32 frame_height, u32 num_vpp_p · line 171
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +10
-0+ size_bin_res = size_yuv *H265_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *41 ) /50 ; + size_bin_res = (size_yuv *59 ) /50 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +}
[Severity: High]
Similar to the H.264 function above, does this missing num_vpp_pipes partitioning logic lead to internal misalignment for secondary pipes?
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 hfi_buffer_persist_h264d(void) · line 347
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +4
-0@@ -230,6 +341,11 @@ static u32 hfi_buffer_persist_h264d(void) DMA_ALIGNMENT); } +static u32 hfi_buffer_persist_h264d_ar50lt (void ) +{ +return ALIGN ((SIZE_SLIST_BUF_H264 *NUM_SLIST_BUF_H264 ),DMA_ALIGNMENT ); +}
[Severity: High]
Does this calculation inadvertently omit the SEI user data allocation?
The original hfi_buffer_persist_h264d() and the new AR50LT HEVC function both include NUM_HW_PIC_BUF * SIZE_SEI_USERDATA, so leaving it out here might cause the hardware to write out of bounds during SEI metadata extraction.
[ ... ]
Quoted 16 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +12
-0@@ -404,6 +584,29 @@ u32 hfi_buffer_line_h265d(u32 frame_width, u32 frame_height, bool is_opb, u32 nureturn ALIGN ((_size + vpss_lb_size),DMA_ALIGNMENT ); } +static inline +u32 hfi_buffer_line_h265d_ar50lt (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h265d_lb_fe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_left_ctrl (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_se_left_ctrl_ar50lt (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + + ALIGN(size_h265d_lb_se_top_ctrl(frame_width, frame_height), DMA_ALIGNMENT) +
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_h265d(u32 frame_width, u32 frame_height, bool is_opb, u32 nu · line 608
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +10
-0+ALIGN (size_h265d_lb_pe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_left (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_recon_dma_metadata_wr (frame_width, frame_height), +DMA_ALIGNMENT ) *4 + +ALIGN (size_h265d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +}
[Severity: High]
Is the is_opb parameter intentionally ignored here?
Without conditionally adding size_vpss_lb() when is_opb is true, could the returned line buffer size be significantly undersized during split mode operations, potentially leading to memory corruption?
[ ... ]
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +2
-0@@ -492,6 +706,19 @@ u32 hfi_iris3_vp9d_lb_size(u32 frame_width, u32 frame_height, u32 num_vpp_pipes)ALIGN (size_vp9d_qp (frame_width, frame_height),DMA_ALIGNMENT ); } +static inline +u32 hfi_ar50lt_vp9d_lb_size (u32 frame_width,u32 frame_height,u32 num_vpp_pipes)
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_iris3_vp9d_lb_size(u32 frame_width, u32 frame_height, u32 num_vpp_pipes) · line 720
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +10
-0+{ +return ALIGN (size_vpxd_lb_fe_left_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vpxd_lb_se_left_ctrl_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vp9d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vpxd_lb_se_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_pe_top_data (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_fe_top_data (frame_width, frame_height),DMA_ALIGNMENT ); +}
[Severity: High]
Are we missing the DMA metadata, top control, and QP map allocations here?
The generic hfi_iris3_vp9d_lb_size() explicitly adds size_vpxd_lb_fe_top_ctrl(), size_vpxd_lb_recon_dma_metadata_wr(), and size_vp9d_qp(). Omitting these could result in an undersized buffer.
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +1
-0+static inline u32 hfi_buffer_line_vp9d (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min,bool is_opb,u32 num_vpp_pipes)
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 742
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +6
-0@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes); +}
[Severity: High]
Does this function also need to check is_opb and add the VPSS line buffer size, similarly to hfi_buffer_line_vp9d()?
[ ... ]
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +8
-0@@ -529,6 +763,25 @@ static u32 hfi_buffer_line_h264d(u32 frame_width, u32 frame_height,return ALIGN ((size + vpss_lb_size),DMA_ALIGNMENT ); } +static u32 hfi_buffer_line_h264d_ar50lt (u32 frame_width,u32 frame_height, +bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h264d_lb_fe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_fe_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + + ALIGN(size_h264d_lb_fe_left_ctrl(frame_height), DMA_ALIGNMENT) * num_vpp_pipes +
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 hfi_buffer_line_h264d(u32 frame_width, u32 frame_height, · line 783
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +10
-0+ALIGN (size_h264d_lb_se_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_se_left_ctrl_ar50lt (frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_h264d_lb_pe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_vsp_top (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_recon_dma_metadata_wr (frame_height),DMA_ALIGNMENT ) *2 + +ALIGN (size_h264d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +}
[Severity: High]
As with the HEVC and VP9 functions above, the is_opb argument is entirely ignored. Could this lead to out-of-bounds DMA writes when split mode is enabled?
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
Re: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
Quoted 5 lines · On Tue, Jun 16, 2026 at 12:21:48AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] The AR50LT decoder line buffer size calculations accept anis_opbparameter but completely ignore it, failing to allocate memory for the VPSS line buffer when OPB (split mode) is enabled.
- [High] The AR50LT BIN buffer size calculations for H.264 and HEVC ignorenum_vpp_pipes, preventing proper buffer partitioning and alignment across hardware pipelines.
- [High] The VP9 AR50LT line buffer calculation omits critical component sizes for DMA metadata and QP maps.
- [High] Missing SEI user data allocation in the H.264 AR50LT persist buffer calculation.
Vikash, Visnu, could you pleae check whether buffer sizes for HFI Gen2 are calculated correctly or not?
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
In reply to Dmitry BaryshkovQuoted 52 lines · Dmitry Baryshkov
From: Dikshita Agarwal <[email protected]>
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 401 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 37 ++ 2 files changed, 438 insertions(+)drivers/media/platform/qcom/iris/iris_vpu_buffer.c +26
-0@@ -50,6 +50,32 @@ static u32 hfi_buffer_bin_h264d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h264d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h264d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <=1920 *1088 *3 /2 ) { + size_bin_hdr = size_yuv *H264_CABAC_HDR_RATIO_SM_TOT ; + size_bin_res = size_yuv *H264_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *3 ) /5 ; + size_bin_res = (size_yuv *3 ) /2 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +} + +static u32 hfi_buffer_bin_h264d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 n_aligned_h =ALIGN (frame_height,16 ); +u32 n_aligned_w =ALIGN (frame_width,16 ); + +return size_h264d_hw_bin_buffer_ar50lt (n_aligned_w, n_aligned_h, num_vpp_pipes); +} +static u32 size_av1d_hw_bin_buffer (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 size_yuv, size_bin_hdr, size_bin_res;@@ -103,6 +129,21 @@ static u32 hfi_buffer_bin_vp9d(u32 frame_width, u32 frame_height, u32 num_vpp_pireturn _size * num_vpp_pipes;
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 hfi_buffer_bin_vp9d(u32 frame_width, u32 frame_height, u32 num_vpp_pi · line 139
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +8
-0} +static u32 hfi_buffer_bin_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size; + + size_yuv =ALIGN (frame_width,16 ) *ALIGN (frame_height,16 ) *3 /2 ; + size_yuv =ALIGN (size_yuv,DMA_ALIGNMENT ); + + size = ALIGN(((((MAX(size_yuv, VPX_DECODER_FRAME_BIN_BUFFER_SIZE)) * 6) / 5) /
MAX() or max() ?
Quoted 309 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +193
-0+ num_vpp_pipes), DMA_ALIGNMENT) + +ALIGN ((((MAX (size_yuv,VPX_DECODER_FRAME_BIN_BUFFER_SIZE )) *4 ) / num_vpp_pipes), +DMA_ALIGNMENT ); + +return size * num_vpp_pipes; +} +static u32 hfi_buffer_bin_h265d (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 n_aligned_w =ALIGN (frame_width,16 );@@ -111,6 +152,32 @@ static u32 hfi_buffer_bin_h265d(u32 frame_width, u32 frame_height, u32 num_vpp_preturn size_h265d_hw_bin_buffer (n_aligned_w, n_aligned_h, num_vpp_pipes); } +static u32 size_h265d_hw_bin_buffer_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_yuv, size_bin_hdr, size_bin_res; + + size_yuv = ((frame_width * frame_height *3 ) >>1 ); +if (size_yuv <= ((BIN_BUFFER_THRESHOLD *3 ) >>1 )) { + size_bin_hdr = size_yuv *H265_CABAC_HDR_RATIO_SM_TOT ; + size_bin_res = size_yuv *H265_CABAC_RES_RATIO_SM_TOT ; + }else { + size_bin_hdr = (size_yuv *41 ) /50 ; + size_bin_res = (size_yuv *59 ) /50 ; + } + size_bin_hdr =ALIGN (size_bin_hdr,DMA_ALIGNMENT ); + size_bin_res =ALIGN (size_bin_res,DMA_ALIGNMENT ); + +return size_bin_hdr + size_bin_res; +} + +static u32 hfi_buffer_bin_h265d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 n_aligned_w =ALIGN (frame_width,16 ); +u32 n_aligned_h =ALIGN (frame_height,16 ); + +return size_h265d_hw_bin_buffer_ar50lt (n_aligned_w, n_aligned_h, num_vpp_pipes); +} +static u32 hfi_buffer_comv_h264d (u32 frame_width,u32 frame_height,u32 _comv_bufcount) {u32 frame_height_in_mbs =DIV_ROUND_UP (frame_height,16 );@@ -174,6 +241,14 @@ static u32 size_h264d_bse_cmd_buf(u32 frame_height)SIZE_H264D_BSE_CMD_PER_BUF ; } +static u32 size_h264d_bse_cmd_buf_ar50lt (u32 frame_height) +{ +u32 height =ALIGN (frame_height,32 ); + +return min_t (u32, (DIV_ROUND_UP (height,16 ) *12 ),H264D_MAX_SLICE ) * +SIZE_H264D_BSE_CMD_PER_BUF ; +} +static u32 size_h265d_bse_cmd_buf (u32 frame_width,u32 frame_height) { u32 _size = ALIGN(((ALIGN(frame_width, LCU_MAX_SIZE_PELS) / LCU_MIN_SIZE_PELS) *@@ -185,6 +260,18 @@ static u32 size_h265d_bse_cmd_buf(u32 frame_width, u32 frame_height)return _size; } +static u32 size_h265d_bse_cmd_buf_ar50lt (u32 frame_width,u32 frame_height) +{ +u32 _size =ALIGN (((ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS )) * +NUM_HW_PIC_BUF ,DMA_ALIGNMENT ); + + _size =min_t (u32, _size,H265D_MAX_SLICE_AR50LT +1 ); + _size =2 * _size *SIZE_H265D_BSE_CMD_PER_BUF ; + +return _size; +} +static u32 hfi_buffer_persist_h265d (u32 rpu_enabled) { return ALIGN((SIZE_SLIST_BUF_H265 * NUM_SLIST_BUF_H265 +@@ -195,6 +282,13 @@ static u32 hfi_buffer_persist_h265d(u32 rpu_enabled) DMA_ALIGNMENT); } +static u32 hfi_buffer_persist_h265d_ar50lt (void ) +{ +return ALIGN ((SIZE_SLIST_BUF_H265 *NUM_SLIST_BUF_H265 + +H265_NUM_TILE *sizeof (u32) +NUM_HW_PIC_BUF *SIZE_SEI_USERDATA ), +DMA_ALIGNMENT ); +} +static inline u32 hfi_iris3_vp9d_comv_size (void ) {@@ -212,6 +306,13 @@ static u32 hfi_buffer_persist_vp9d(void)HDR10_HIST_EXTRADATA_SIZE ; } +static u32 hfi_buffer_persist_vp9d_ar50lt (void ) +{ +return ALIGN (VP9_NUM_PROBABILITY_TABLE_BUF *VP9_PROB_TABLE_SIZE ,DMA_ALIGNMENT ) + +ALIGN (hfi_iris3_vp9d_comv_size (),DMA_ALIGNMENT ) + +ALIGN (MAX_SUPERFRAME_HEADER_LEN ,DMA_ALIGNMENT ); +} +static u32 size_h264d_vpp_cmd_buf (u32 frame_height) {u32 size, height =ALIGN (frame_height,32 );@@ -222,6 +323,16 @@ static u32 size_h264d_vpp_cmd_buf(u32 frame_height)return size >VPP_CMD_MAX_SIZE ?VPP_CMD_MAX_SIZE : size; } +static u32 size_h264d_vpp_cmd_buf_ar50lt (u32 frame_height) +{ +u32 size, height =ALIGN (frame_height,32 ); + + size =min_t (u32, (DIV_ROUND_UP (height,16 ) *12 ),H264D_MAX_SLICE ) * +SIZE_H264D_VPP_CMD_PER_BUF ; + +return size >VPP_CMD_MAX_SIZE ?VPP_CMD_MAX_SIZE : size; +} +static u32 hfi_buffer_persist_h264d (void ) { return ALIGN(SIZE_SLIST_BUF_H264 * NUM_SLIST_BUF_H264 +@@ -230,6 +341,11 @@ static u32 hfi_buffer_persist_h264d(void) DMA_ALIGNMENT); } +static u32 hfi_buffer_persist_h264d_ar50lt (void ) +{ +return ALIGN ((SIZE_SLIST_BUF_H264 *NUM_SLIST_BUF_H264 ),DMA_ALIGNMENT ); +} +static u32 hfi_buffer_persist_av1d (u32 max_width,u32 max_height,u32 total_ref_count) {u32 comv_size, size;@@ -255,6 +371,17 @@ static u32 hfi_buffer_non_comv_h264d(u32 frame_width, u32 frame_height, u32 num_return ALIGN (size,DMA_ALIGNMENT ); } +static u32 hfi_buffer_non_comv_h264d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 size_bse =size_h264d_bse_cmd_buf_ar50lt (frame_height); +u32 size_vpp =size_h264d_vpp_cmd_buf_ar50lt (frame_height); +u32 size =ALIGN (size_bse,DMA_ALIGNMENT ) + +ALIGN (size_vpp,DMA_ALIGNMENT ) + +ALIGN (SIZE_HW_PIC (SIZE_H264D_HW_PIC_T ),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static u32 size_h265d_vpp_cmd_buf (u32 frame_width,u32 frame_height) { u32 _size = ALIGN(((ALIGN(frame_width, LCU_MAX_SIZE_PELS) / LCU_MIN_SIZE_PELS) *@@ -269,6 +396,20 @@ static u32 size_h265d_vpp_cmd_buf(u32 frame_width, u32 frame_height)return _size; } +static u32 size_h265d_vpp_cmd_buf_ar50lt (u32 frame_width,u32 frame_height) +{ +u32 _size =ALIGN (((ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS )) * +NUM_HW_PIC_BUF ,DMA_ALIGNMENT ); + _size =min_t (u32, _size,H265D_MAX_SLICE_AR50LT +1 ); + _size =ALIGN (_size,4 ); + _size =2 * _size *SIZE_H265D_VPP_CMD_PER_BUF_AR50LT ; +if (_size >VPP_CMD_MAX_SIZE ) + _size =VPP_CMD_MAX_SIZE ; + +return _size; +} +static u32 hfi_buffer_non_comv_h265d (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) {u32 _size_bse =size_h265d_bse_cmd_buf (frame_width, frame_height);@@ -285,6 +426,20 @@ static u32 hfi_buffer_non_comv_h265d(u32 frame_width, u32 frame_height, u32 num_return ALIGN (_size,DMA_ALIGNMENT ); } +static u32 hfi_buffer_non_comv_h265d_ar50lt (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +u32 _size_bse =size_h265d_bse_cmd_buf_ar50lt (frame_width, frame_height); +u32 _size_vpp =size_h265d_vpp_cmd_buf_ar50lt (frame_width, frame_height); +u32 _size =ALIGN (_size_bse,DMA_ALIGNMENT ) + +ALIGN (_size_vpp,DMA_ALIGNMENT ) + +ALIGN (2 *sizeof (u16) * + (ALIGN (frame_width,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ) * + (ALIGN (frame_height,LCU_MAX_SIZE_PELS ) /LCU_MIN_SIZE_PELS ),DMA_ALIGNMENT ) + +ALIGN (SIZE_HW_PIC (SIZE_H265D_HW_PIC_T ),DMA_ALIGNMENT ); + +return ALIGN (_size,DMA_ALIGNMENT ); +} +static u32 size_vpss_lb (u32 frame_width,u32 frame_height) {u32 opb_lb_wr_llb_y_buffer_size, opb_lb_wr_llb_uv_buffer_size;@@ -317,6 +472,13 @@ u32 size_h265d_lb_fe_top_data(u32 frame_width, u32 frame_height) (ALIGN (frame_width,64 ) +8 ) *2 ; } +static inline +u32 size_h265d_lb_fe_top_data_ar50lt (u32 frame_width,u32 frame_height) +{ +return ALIGN (MAX_FE_NBR_DATA_LUMA_LINE_BUFFER_SIZE * + (ALIGN (frame_width,64 ) +8 ),DMA_ALIGNMENT ) *2 ; +} +static inline u32 size_h265d_lb_fe_top_ctrl (u32 frame_width,u32 frame_height) {@@ -348,6 +510,17 @@ u32 size_h265d_lb_se_left_ctrl(u32 frame_width, u32 frame_height) MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE)); } +static inline +u32 size_h265d_lb_se_left_ctrl_ar50lt (u32 frame_width,u32 frame_height) +{ +return max_t (u32, ((frame_height +16 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE_AR50LT , +max_t (u32, ((frame_height +32 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE_AR50LT , + ((frame_height +64 -1 ) /8 ) * +MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT )); +} +static inline u32 size_h265d_lb_pe_top_data (u32 frame_width,u32 frame_height) {@@ -355,6 +528,13 @@ u32 size_h265d_lb_pe_top_data(u32 frame_width, u32 frame_height) (ALIGN (frame_width,LCU_MIN_SIZE_PELS ) /LCU_MIN_SIZE_PELS ); } +static inline +u32 size_h265d_lb_pe_top_data_ar50lt (u32 frame_width,u32 frame_height) +{ +return MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE_AR50LT * + (ALIGN (frame_width,LCU_MIN_SIZE_PELS ) /LCU_MIN_SIZE_PELS ); +} +static inline u32 size_h265d_lb_vsp_top (u32 frame_width,u32 frame_height) {@@ -404,6 +584,29 @@ u32 hfi_buffer_line_h265d(u32 frame_width, u32 frame_height, bool is_opb, u32 nureturn ALIGN ((_size + vpss_lb_size),DMA_ALIGNMENT ); } +static inline +u32 hfi_buffer_line_h265d_ar50lt (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h265d_lb_fe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_fe_left_ctrl (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_se_left_ctrl_ar50lt (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_se_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_pe_top_data_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_h265d_lb_vsp_left (frame_width, frame_height), +DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h265d_lb_recon_dma_metadata_wr (frame_width, frame_height), +DMA_ALIGNMENT ) *4 + +ALIGN (size_h265d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static inline u32 size_vpxd_lb_fe_left_ctrl (u32 frame_width,u32 frame_height) {@@ -438,6 +641,17 @@ u32 size_vpxd_lb_se_left_ctrl(u32 frame_width, u32 frame_height) MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE)); } +static inline +u32 size_vpxd_lb_se_left_ctrl_ar50lt (u32 frame_width,u32 frame_height) +{ +return max_t (u32, ((frame_height +15 ) >>4 ) * +MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE_AR50LT , +max_t (u32, ((frame_height +31 ) >>5 ) * +MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE_AR50LT , + ((frame_height +63 ) >>6 ) * +MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT )); +} +static inline u32 size_vpxd_lb_recon_dma_metadata_wr (u32 frame_width,u32 frame_height) {@@ -492,6 +706,19 @@ u32 hfi_iris3_vp9d_lb_size(u32 frame_width, u32 frame_height, u32 num_vpp_pipes)ALIGN (size_vp9d_qp (frame_width, frame_height),DMA_ALIGNMENT ); } +static inline +u32 hfi_ar50lt_vp9d_lb_size (u32 frame_width,u32 frame_height,u32 num_vpp_pipes) +{ +return ALIGN (size_vpxd_lb_fe_left_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vpxd_lb_se_left_ctrl_ar50lt (frame_width, frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_vp9d_lb_vsp_top (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vpxd_lb_se_top_ctrl (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_pe_top_data (frame_width, frame_height),DMA_ALIGNMENT ) + +ALIGN (size_vp9d_lb_fe_top_data (frame_width, frame_height),DMA_ALIGNMENT ); +} +static inline u32 hfi_buffer_line_vp9d (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min,bool is_opb,u32 num_vpp_pipes)
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 741
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +5
-0@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes);
pls keep same name across like "hfi_buffer_line_vp9d_ar50lt" and "hfi_ar50lt_vp9d_lb_size" or combine these 2 apis, as the one just calls the other.
Quoted 75 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +50
-0+} +static u32 hfi_buffer_line_h264d (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) {@@ -529,6 +763,25 @@ static u32 hfi_buffer_line_h264d(u32 frame_width, u32 frame_height,return ALIGN ((size + vpss_lb_size),DMA_ALIGNMENT ); } +static u32 hfi_buffer_line_h264d_ar50lt (u32 frame_width,u32 frame_height, +bool is_opb,u32 num_vpp_pipes) +{ +u32 size; + + size =ALIGN (size_h264d_lb_fe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_fe_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_fe_left_ctrl (frame_height),DMA_ALIGNMENT ) * num_vpp_pipes + +ALIGN (size_h264d_lb_se_top_ctrl_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_se_left_ctrl_ar50lt (frame_height),DMA_ALIGNMENT ) * + num_vpp_pipes + +ALIGN (size_h264d_lb_pe_top_data_ar50lt (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_vsp_top (frame_width),DMA_ALIGNMENT ) + +ALIGN (size_h264d_lb_recon_dma_metadata_wr (frame_height),DMA_ALIGNMENT ) *2 + +ALIGN (size_h264d_qp (frame_width, frame_height),DMA_ALIGNMENT ); + +return ALIGN (size,DMA_ALIGNMENT ); +} +static u32 size_av1d_lb_opb_wr1_nv12_ubwc (u32 frame_width,u32 frame_height) {u32 size, y_width, y_width_a =128 ;@@ -724,6 +977,23 @@ static u32 iris_vpu_dec_bin_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_bin_size (struct iris_inst *inst) +{ +u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe; +struct v4l2_format *f = inst->fmt_src; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; + +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_bin_h264d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_bin_h265d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_VP9 ) +return hfi_buffer_bin_vp9d_ar50lt (width, height, num_vpp_pipes); + +return 0 ; +} +static u32 iris_vpu_dec_comv_size (struct iris_inst *inst) {u32 num_comv =VIDEO_MAX_FRAME ;@@ -785,6 +1055,18 @@ static u32 iris_vpu_dec_persist_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_persist_size (struct iris_inst *inst) +{ +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_persist_h264d_ar50lt (); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_persist_h265d_ar50lt (); +else if (inst->codec ==V4L2_PIX_FMT_VP9 ) +return hfi_buffer_persist_vp9d_ar50lt (); + +return 0 ; +} +static u32 iris_vpu_dec_dpb_size (struct iris_inst *inst) {if (iris_split_mode_enabled (inst))
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 iris_vpu_dec_non_comv_size(struct iris_inst *inst) · line 1095
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +3
-0@@ -808,6 +1090,21 @@ static u32 iris_vpu_dec_non_comv_size(struct iris_inst *inst)return 0 ; } +static u32 iris_vpu_ar50lt_dec_non_comv_size (struct iris_inst *inst) +{ +u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe;
neither of below api uses this variable ?
Quoted 16 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +12
-0+struct v4l2_format *f = inst->fmt_src; +u32 height = f->fmt.pix_mp.height; +u32 width = f->fmt.pix_mp.width; + +if (inst->codec ==V4L2_PIX_FMT_H264 ) +return hfi_buffer_non_comv_h264d_ar50lt (width, height, num_vpp_pipes); +else if (inst->codec ==V4L2_PIX_FMT_HEVC ) +return hfi_buffer_non_comv_h265d_ar50lt (width, height, num_vpp_pipes); + +return 0 ; +} +static u32 iris_vpu_dec_line_size (struct iris_inst *inst) {u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe;
drivers/media/platform/qcom/iris/iris_vpu_buffer.c static u32 iris_vpu_dec_line_size(struct iris_inst *inst) · line 1132
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +0
-0@@ -833,6 +1130,29 @@ static u32 iris_vpu_dec_line_size(struct iris_inst *inst)return 0 ; }
Regards,
Vikash
Re: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
Quoted 16 lines · Vikash Garodia
Quoted 13 lines · Dmitry Baryshkov
From: Dikshita Agarwal <[email protected]>
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 401 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 37 ++ 2 files changed, 438 insertions(+)
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 740
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +5
-0@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes);pls keep same name across like "
hfi_buffer_line_vp9d_ar50lt" and "hfi_ar50lt_vp9d_lb_size" or combine these 2 apis, as the one just calls the other.
I think, Sashiko pointout a different issue here. Should I be calling size_vpss_lb() to take is_opb into account?
Quoted 6 lines
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +2
-0+} +static u32 hfi_buffer_line_h264d (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) {
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
Quoted 30 lines · Dmitry Baryshkov
Quoted 16 lines · Vikash Garodia
Quoted 13 lines · Dmitry Baryshkov
From: Dikshita Agarwal <[email protected]>
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 401 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 37 ++ 2 files changed, 438 insertions(+)Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 740
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +5
-0@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes);pls keep same name across like "
hfi_buffer_line_vp9d_ar50lt" and "hfi_ar50lt_vp9d_lb_size" or combine these 2 apis, as the one just calls the other.
Quoted 2 lines
I think, Sashiko pointout a different issue here. Should I be calling
size_vpss_lb()to takeis_opbinto account?
The comment is generalizing the ar50 with other iris variants, we dont need that for AR50LT variants.
Quoted 8 lines
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 746
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +2
-0+} +static u32 hfi_buffer_line_h264d (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) {
Regards,
Vikash
Re: [PATCH v5 13/16] media: iris: Introduce buffer size calculations for AR50LT
Quoted 33 lines · Vikash Garodia
Quoted 30 lines · Dmitry Baryshkov
Quoted 28 lines · Vikash Garodia
Quoted 14 lines · Dmitry Baryshkov
From: Dikshita Agarwal <[email protected]>
Introduces AR50LT buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the AR50LT specific ones separately.
Signed-off-by Dikshita Agarwal <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 401 +++++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 37 ++ 2 files changed, 438 insertions(+)drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 740
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +5
-0@@ -507,6 +734,13 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mireturn _lb_size + vpss_lb_size +4096 ; } +static inline +u32 hfi_buffer_line_vp9d_ar50lt (u32 frame_width,u32 frame_height,u32 _yuv_bufcount_min, +bool is_opb,u32 num_vpp_pipes) +{ +return hfi_ar50lt_vp9d_lb_size (frame_width, frame_height, num_vpp_pipes);pls keep same name across like "
hfi_buffer_line_vp9d_ar50lt" and "hfi_ar50lt_vp9d_lb_size" or combine these 2 apis, as the one just calls the other.
Quoted 5 lines
Quoted 2 lines
I think, Sashiko pointout a different issue here. Should I be calling
size_vpss_lb()to takeis_opbinto account?The comment is generalizing the ar50 with other iris variants, we dont need that for AR50LT variants.
Ack, I'll cleanup is_opb and num_vpp_pipes from AR50LT code.
Quoted 12 lines
Quoted 9 lines
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi · line 746
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_buffer.c +2
-0+} +static u32 hfi_buffer_line_h264d (u32 frame_width,u32 frame_height,bool is_opb,u32 num_vpp_pipes) {Regards,
Vikash
Signature · 2 lines
With best wishes Dmitry
PATCH v5 14/16 media: iris: add Gen2 firmware support on the Agatti platform
In reply to Dmitry BaryshkovFrom: Dikshita Agarwal <[email protected]>
Agatti platform is using HFI Gen1 firmware, which is considered to be legacy firmware branch. Follow the example of the SC7280 platform and extend the driver with supporting both HFI Gen1 and Gen2 firmwares for this platform. Like HFI Gen1 this firmware doesn't have PIPE property (but unlike Gen1 buffer sizes are calculated on the driver side).
--- drivers/media/platform/qcom/iris/iris_hfi_gen2.c | 613 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 1 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 11 +- 3 files changed, 623 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2.c +613 -0
@@ -1118,3 +1118,616 @@ const struct iris_firmware_data iris_hfi_gen2_data = { .enc_op_int_buf_tbl = sm8550_enc_op_int_buf_tbl, .enc_op_int_buf_tbl_size = ARRAY_SIZE(sm8550_enc_op_int_buf_tbl), }; + +static const struct platform_inst_fw_cap inst_fw_cap_gen2_ar50lt_dec[] = { + { + .cap_id =PROFILE_H264 , + .min =V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE , + .max =V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH ), + .value =V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , + .hfi_id =HFI_PROP_PROFILE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =PROFILE_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE ), + .value =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .hfi_id =HFI_PROP_PROFILE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =PROFILE_VP9 , + .min =V4L2_MPEG_VIDEO_VP9_PROFILE_0 , + .max =V4L2_MPEG_VIDEO_VP9_PROFILE_0 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_VP9_PROFILE_0 ), + .value =V4L2_MPEG_VIDEO_VP9_PROFILE_0 , + .hfi_id =HFI_PROP_PROFILE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =LEVEL_H264 , + .min =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1B ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_3 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_2 ), + .value =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .hfi_id =HFI_PROP_LEVEL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =LEVEL_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .max =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .hfi_id =HFI_PROP_LEVEL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =LEVEL_VP9 , + .min =V4L2_MPEG_VIDEO_VP9_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 , + .hfi_id =HFI_PROP_LEVEL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =TIER , + .min =V4L2_MPEG_VIDEO_HEVC_TIER_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_TIER_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_TIER_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_TIER_HIGH ), + .value =V4L2_MPEG_VIDEO_HEVC_TIER_HIGH , + .hfi_id =HFI_PROP_TIER , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_u32_enum, + }, + { + .cap_id =INPUT_BUF_HOST_MAX_COUNT , + .min =DEFAULT_MAX_HOST_BUF_COUNT , + .max =DEFAULT_MAX_HOST_BURST_BUF_COUNT , + .step_or_mask =1 , + .value =DEFAULT_MAX_HOST_BUF_COUNT , + .hfi_id =HFI_PROP_BUFFER_HOST_MAX_COUNT , + .flags =CAP_FLAG_INPUT_PORT , + .set = iris_set_u32, + }, + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROP_STAGE , + .set = iris_set_stage, + }, + { + .cap_id =POC , + .min =0 , + .max =2 , + .step_or_mask =1 , + .value =1 , + .hfi_id =HFI_PROP_PIC_ORDER_CNT_TYPE , + }, + { + .cap_id =CODED_FRAMES , + .min =CODED_FRAMES_PROGRESSIVE , + .max =CODED_FRAMES_PROGRESSIVE , + .step_or_mask =0 , + .value =CODED_FRAMES_PROGRESSIVE , + .hfi_id =HFI_PROP_CODED_FRAMES , + }, + { + .cap_id =BIT_DEPTH , + .min =BIT_DEPTH_8 , + .max =BIT_DEPTH_8 , + .step_or_mask =1 , + .value =BIT_DEPTH_8 , + .hfi_id =HFI_PROP_LUMA_CHROMA_BIT_DEPTH , + }, + { + .cap_id =RAP_FRAME , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =1 , + .hfi_id =HFI_PROP_DEC_START_FROM_RAP_FRAME , + .flags =CAP_FLAG_INPUT_PORT , + .set = iris_set_u32, + }, +}; + +static const struct platform_inst_fw_cap inst_fw_cap_gen2_ar50lt_enc[] = { + { + .cap_id =PROFILE_H264 , + .min =V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE , + .max =V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ), + .value =V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , + .hfi_id =HFI_PROP_PROFILE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile, + }, + { + .cap_id =PROFILE_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .max =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN ) | +BIT (V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE ), + .value =V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN , + .hfi_id =HFI_PROP_PROFILE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_profile, + }, + { + .cap_id =LEVEL_H264 , + .min =V4L2_MPEG_VIDEO_H264_LEVEL_1_0 , + .max =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1B ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_1_3 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_2_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_3_2 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_0 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_1 ) | +BIT (V4L2_MPEG_VIDEO_H264_LEVEL_4_2 ), + .value =V4L2_MPEG_VIDEO_H264_LEVEL_4_2 , + .hfi_id =HFI_PROP_LEVEL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_level, + }, + { + .cap_id =LEVEL_HEVC , + .min =V4L2_MPEG_VIDEO_HEVC_LEVEL_1 , + .max =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4 ) | +BIT (V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 ), + .value =V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 , + .hfi_id =HFI_PROP_LEVEL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_level, + }, + { + .cap_id =STAGE , + .min =STAGE_1 , + .max =STAGE_2 , + .step_or_mask =1 , + .value =STAGE_2 , + .hfi_id =HFI_PROP_STAGE , + .set = iris_set_stage, + }, + { + .cap_id =HEADER_MODE , + .min =V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE , + .max =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE ) | +BIT (V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME ), + .value =V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME , + .hfi_id =HFI_PROP_SEQ_HEADER_MODE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_header_mode_gen2, + }, + { + .cap_id =PREPEND_SPSPPS_TO_IDR , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =0 , + }, + { + .cap_id =BITRATE , + .min =1 , + .max =BITRATE_MAX_AR50LT , + .step_or_mask =1 , + .value =BITRATE_DEFAULT_AR50LT , + .hfi_id =HFI_PROP_TOTAL_BITRATE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_bitrate_gen2, + }, + { + .cap_id =BITRATE_PEAK , + .min =1 , + .max =BITRATE_MAX_AR50LT , + .step_or_mask =1 , + .value =BITRATE_DEFAULT_AR50LT , + .hfi_id =HFI_PROP_TOTAL_PEAK_BITRATE , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_peak_bitrate, + }, + { + .cap_id =BITRATE_MODE , + .min =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .max =V4L2_MPEG_VIDEO_BITRATE_MODE_CBR , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_VBR ) | +BIT (V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ), + .value =V4L2_MPEG_VIDEO_BITRATE_MODE_VBR , + .hfi_id =HFI_PROP_RATE_CONTROL , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_bitrate_mode_gen2, + }, + { + .cap_id =FRAME_SKIP_MODE , + .min =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .max =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED ) | +BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT ) | +BIT (V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT ), + .value =V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + }, + { + .cap_id =FRAME_RC_ENABLE , + .min =0 , + .max =1 , + .step_or_mask =1 , + .value =1 , + }, + { + .cap_id =GOP_SIZE , + .min =0 , + .max =INT_MAX , + .step_or_mask =1 , + .value =2 *DEFAULT_FPS -1 , + .hfi_id =HFI_PROP_MAX_GOP_FRAMES , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_u32, + }, + { + .cap_id =ENTROPY_MODE , + .min =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC , + .max =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC , + .step_or_mask =BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC ) | +BIT (V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC ), + .value =V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC , + .hfi_id =HFI_PROP_CABAC_SESSION , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + .set = iris_set_entropy_mode_gen2, + }, + { + .cap_id =MIN_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROP_MIN_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_min_qp, + }, + { + .cap_id =MIN_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + .hfi_id =HFI_PROP_MIN_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_min_qp, + }, + { + .cap_id =MAX_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + .hfi_id =HFI_PROP_MAX_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_max_qp, + }, + { + .cap_id =MAX_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + .hfi_id =HFI_PROP_MAX_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_max_qp, + }, + { + .cap_id =I_FRAME_MIN_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =I_FRAME_MIN_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =P_FRAME_MIN_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =P_FRAME_MIN_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =B_FRAME_MIN_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =B_FRAME_MIN_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MIN_QP_8BIT_AR50LT , + }, + { + .cap_id =I_FRAME_MAX_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =I_FRAME_MAX_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =P_FRAME_MAX_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =P_FRAME_MAX_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =B_FRAME_MAX_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =B_FRAME_MAX_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =MAX_QP , + }, + { + .cap_id =I_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =I_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =P_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =P_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =B_FRAME_QP_H264 , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =B_FRAME_QP_HEVC , + .min =MIN_QP_8BIT_AR50LT , + .max =MAX_QP , + .step_or_mask =1 , + .value =DEFAULT_QP , + .hfi_id =HFI_PROP_QP_PACKED , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_INPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_frame_qp, + }, + { + .cap_id =INPUT_BUF_HOST_MAX_COUNT , + .min =DEFAULT_MAX_HOST_BUF_COUNT , + .max =DEFAULT_MAX_HOST_BURST_BUF_COUNT , + .step_or_mask =1 , + .value =DEFAULT_MAX_HOST_BUF_COUNT , + .hfi_id =HFI_PROP_BUFFER_HOST_MAX_COUNT , + .flags =CAP_FLAG_INPUT_PORT , + .set = iris_set_u32, + }, + { + .cap_id =OUTPUT_BUF_HOST_MAX_COUNT , + .min =DEFAULT_MAX_HOST_BUF_COUNT , + .max =DEFAULT_MAX_HOST_BURST_BUF_COUNT , + .step_or_mask =1 , + .value =DEFAULT_MAX_HOST_BUF_COUNT , + .hfi_id =HFI_PROP_BUFFER_HOST_MAX_COUNT , + .flags =CAP_FLAG_OUTPUT_PORT , + .set = iris_set_u32, + }, + { + .cap_id =IR_TYPE , + .min =V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM , + .max =V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM , + .step_or_mask =BIT (V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM ), + .value =V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM , + .flags =CAP_FLAG_OUTPUT_PORT |CAP_FLAG_MENU , + }, + { + .cap_id =IR_PERIOD , + .min =0 , + .max =INT_MAX , + .step_or_mask =1 , + .value =0 , + .flags =CAP_FLAG_OUTPUT_PORT | +CAP_FLAG_DYNAMIC_ALLOWED , + .set = iris_set_ir_period_gen2, + }, +}; + +static const u32 iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl[] = { +BUF_BIN , +BUF_COMV , +BUF_NON_COMV , +BUF_LINE , +}; + +const struct iris_firmware_data iris_hfi_gen2_ar50lt_data = { + .init_hfi_ops = iris_hfi_gen2_sys_ops_init, + + .core_arch =VIDEO_ARCH_LX , + + .inst_fw_caps_dec = inst_fw_cap_gen2_ar50lt_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (inst_fw_cap_gen2_ar50lt_dec), + .inst_fw_caps_enc = inst_fw_cap_gen2_ar50lt_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_gen2_ar50lt_enc), + .dec_input_config_params_default = + sm8550_vdec_input_config_params_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8550_vdec_input_config_params_default), + .dec_input_config_params_hevc = + sm8550_vdec_input_config_param_hevc, + .dec_input_config_params_hevc_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_hevc), + .dec_input_config_params_vp9 = + sm8550_vdec_input_config_param_vp9, + .dec_input_config_params_vp9_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_vp9), + .dec_output_config_params = + sm8550_vdec_output_config_params, + .dec_output_config_params_size = +ARRAY_SIZE (sm8550_vdec_output_config_params), + .enc_input_config_params = + sm8550_venc_input_config_params, + .enc_input_config_params_size = +ARRAY_SIZE (sm8550_venc_input_config_params), + .enc_output_config_params = + sm8550_venc_output_config_params, + .enc_output_config_params_size = +ARRAY_SIZE (sm8550_venc_output_config_params), + .dec_input_prop = sm8550_vdec_subscribe_input_properties, + .dec_input_prop_size =ARRAY_SIZE (sm8550_vdec_subscribe_input_properties), + .dec_output_prop_avc = sm8550_vdec_subscribe_output_properties_avc, + .dec_output_prop_avc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_avc), + .dec_output_prop_hevc = sm8550_vdec_subscribe_output_properties_hevc, + .dec_output_prop_hevc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_hevc), + .dec_output_prop_vp9 = sm8550_vdec_subscribe_output_properties_vp9, + .dec_output_prop_vp9_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_vp9), + .dec_ip_int_buf_tbl = iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (iris_hfi_gen2_ar50lt_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8550_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_dec_op_int_buf_tbl), + .enc_ip_int_buf_tbl = sm8550_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_ip_int_buf_tbl), + .enc_op_int_buf_tbl = sm8550_enc_op_int_buf_tbl, + .enc_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_op_int_buf_tbl), +};
drivers/media/platform/qcom/iris/iris_platform_common.h +1 -0
@@ -57,6 +57,7 @@ enum pipe_type {extern const struct iris_firmware_data iris_hfi_gen1_data;extern const struct iris_firmware_data iris_hfi_gen1_ar50lt_data;extern const struct iris_firmware_data iris_hfi_gen2_data; +extern const struct iris_firmware_data iris_hfi_gen2_ar50lt_data;extern const struct iris_platform_data qcm2290_data;extern const struct iris_platform_data qcs8300_data;
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c +9 -2
@@ -13,12 +13,18 @@#define WRAPPER_INTR_STATUS_A2HWD_BMSK 0x10 -const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen1_s6_desc = { +const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen1_desc = { .firmware_data = &iris_hfi_gen1_ar50lt_data, .get_vpu_buffer_size = iris_vpu_ar50lt_gen1_buf_size, .fwname ="qcom/venus-6.0/venus.mbn" , }; +const struct iris_firmware_desc iris_vpu_ar50lt_p1_gen2_s6_desc = { + .firmware_data = &iris_hfi_gen2_ar50lt_data, + .get_vpu_buffer_size = iris_vpu_ar50lt_gen2_buf_size, + .fwname ="qcom/vpu/ar50lt_p1_gen2_s6.mbn" , +}; +static const u32 iris_fmts_ar50lt_dec[] = { [IRIS_FMT_H264 ] =V4L2_PIX_FMT_H264 , [IRIS_FMT_HEVC ] =V4L2_PIX_FMT_HEVC ,
@@ -78,7 +84,8 @@ static struct platform_inst_caps platform_inst_cap_ar50lt = { };const struct iris_platform_data qcm2290_data = { - .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_s6_desc, + .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_desc, + .firmware_desc_gen2 = &iris_vpu_ar50lt_p1_gen2_s6_desc, .vpu_ops = &iris_vpu_ar50lt_ops, .icc_tbl = iris_icc_info_ar50lt, .icc_tbl_size =ARRAY_SIZE (iris_icc_info_ar50lt),
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v5 14/16] media: iris: add Gen2 firmware support on the Agatti platform
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Incomplete dual firmware refactoring leads to build breakage and NULL pointer dereference during…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incomplete dual firmware refactoring leads to build breakage and NULL pointer dereference during device probe. --
commit 56abb89242d476eadcfa7c399ffc9ee1dfc1fca4
Author: Dikshita Agarwal <[email protected]>
media: iris: add Gen2 firmware support on the Agatti platform
This patch extends the iris driver to support both HFI Gen1 and Gen2 firmwares for the Agatti platform.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c static struct platform_inst_caps platform_inst_cap_ar50lt = { · line 89
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c +2
-1@@ -78,7 +84,8 @@ static struct platform_inst_caps platform_inst_cap_ar50lt = { };const struct iris_platform_data qcm2290_data = { - .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_s6_desc, + .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_desc, + .firmware_desc_gen2 = &iris_vpu_ar50lt_p1_gen2_s6_desc, .vpu_ops = &iris_vpu_ar50lt_ops,
[Severity: High]
Does struct iris_platform_data actually contain the firmware_desc_gen2 field?
It looks like this might cause a build failure if struct iris_platform_data hasn't been updated to include these specific gen1/gen2 fields.
Additionally, does this introduce a NULL pointer dereference during device probe? If iris_probe() in drivers/media/platform/qcom/iris/iris_probe.c still unconditionally reads the legacy firmware_desc field:
iris_probe() {
...
core->iris_firmware_desc = core->iris_platform_data->firmware_desc;
core->iris_firmware_data = core->iris_firmware_desc->firmware_data;
...
}Won't this dereference a NULL pointer since the legacy firmware_desc is left uninitialized for this platform? It seems a prerequisite patch refactoring struct iris_platform_data and the probe function might be missing from this series.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
Re: [PATCH v5 14/16] media: iris: add Gen2 firmware support on the Agatti platform
Quoted 31 lines · On Tue, Jun 16, 2026 at 12:26:06AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incomplete dual firmware refactoring leads to build breakage and NULL pointer dereference during device probe. --commit
56abb89242d476eadcfa7c399ffc9ee1dfc1fca4
Author: Dikshita Agarwal <[email protected]>media: iris: add Gen2 firmware support on the Agatti platform
This patch extends the iris driver to support both HFI Gen1 and Gen2 firmwares for the Agatti platform.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c +0
-0[ ... ]
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c static struct platform_inst_caps platform_inst_cap_ar50lt = { · line 89
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_platform_vpu_ar50lt.c +2
-1@@ -78,7 +84,8 @@ static struct platform_inst_caps platform_inst_cap_ar50lt = { };const struct iris_platform_data qcm2290_data = { - .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_s6_desc, + .firmware_desc_gen1 = &iris_vpu_ar50lt_p1_gen1_desc, + .firmware_desc_gen2 = &iris_vpu_ar50lt_p1_gen2_s6_desc, .vpu_ops = &iris_vpu_ar50lt_ops,[Severity: High]
Does structiris_platform_dataactually contain thefirmware_desc_gen2field?
Quoted 2 lines
It looks like this might cause a build failure if struct
iris_platform_datahasn't been updated to include these specific gen1/gen2 fields.
Huh? It's listed as a dependency patch.
Quoted 19 lines
Additionally, does this introduce a NULL pointer dereference during device probe? If
iris_probe()indrivers/media/platform/qcom/iris/iris_probe.cstill unconditionally reads the legacyfirmware_descfield:iris_probe() { ... core->iris_firmware_desc = core->iris_platform_data->firmware_desc; core->iris_firmware_data = core->iris_firmware_desc->firmware_data; ... }Won't this dereference a NULL pointer since the legacy
firmware_descis left uninitialized for this platform? It seems a prerequisite patch refactoring structiris_platform_dataand the probe function might be missing from this series.Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 14/16] media: iris: add Gen2 firmware support on the Agatti platform
In reply to Dmitry BaryshkovQuoted 8 lines · Dmitry Baryshkov
From: Dikshita Agarwal<[email protected]>
Agatti platform is using HFI Gen1 firmware, which is considered to be legacy firmware branch. Follow the example of the SC7280 platform and extend the driver with supporting both HFI Gen1 and Gen2 firmwares for this platform. Like HFI Gen1 this firmware doesn't have PIPE property (but unlike Gen1 buffer sizes are calculated on the driver side).
Quoted 7 lines
Signed-off-by Dikshita Agarwal<[email protected]>Signed-off-by Dmitry Baryshkov<[email protected]>--- drivers/media/platform/qcom/iris/iris_hfi_gen2.c | 613 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_common.h | 1 + .../platform/qcom/iris/iris_platform_vpu_ar50lt.c | 11 +- 3 files changed, 623 insertions(+), 2 deletions(-)
PATCH v5 15/16 media: venus: skip QCM2290 if Iris driver is enabled
In reply to Dmitry BaryshkovAs the Iris driver now supports the QCM2290 hardware too, there is a race between Venus and Iris drivers on binding to the corresponding device. Follow the approach used by other platforms and skip QCM2290 in the Venus driver if Iris is enabled.
--- drivers/media/platform/qcom/venus/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +3 -1
@@ -1118,7 +1118,6 @@ static const struct venus_resources sc7280_res = { .dec_nodename = "video-decoder", .enc_nodename = "video-encoder", }; -#endif static const struct bw_tbl qcm2290_bw_table_dec[] = { {352800 ,597000 ,0 ,746000 ,0 },/* 1080p@30 + 720p@30 */
@@ -1169,13 +1168,16 @@ static const struct venus_resources qcm2290_res = { .enc_nodename = "video-encoder", .min_fw = &min_fw, }; +#endif static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8939-venus" , .data = &msm8939_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, }, { .compatible ="qcom,msm8998-venus" , .data = &msm8998_res, }, +#if (!IS_ENABLED(CONFIG_VIDEO_QCOM_IRIS)) { .compatible ="qcom,qcm2290-venus" , .data = &qcm2290_res, }, +#endif { .compatible ="qcom,sc7180-venus" , .data = &sc7180_res, }, { .compatible ="qcom,sdm660-venus" , .data = &sdm660_res, }, { .compatible ="qcom,sdm845-venus" , .data = &sdm845_res, },
Signature · 1 line
2.47.3
Re: [PATCH v5 15/16] media: venus: skip QCM2290 if Iris driver is enabled
Quoted 10 lines · Dmitry Baryshkov
As the Iris driver now supports the QCM2290 hardware too, there is a race between Venus and Iris drivers on binding to the corresponding device. Follow the approach used by other platforms and skip QCM2290 in the Venus driver if Iris is enabled.
Signed-off-by Dmitry Baryshkov<[email protected]>Reviewed-by Dikshita Agarwal<[email protected]>--- drivers/media/platform/qcom/venus/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
PATCH v5 16/16 media: iris: constify inst_fw_cap_sm8250_dec
In reply to Dmitry BaryshkovMark inst_fw_cap_sm8250_dec as a const array, the data is read-only.
--- drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1.c +1 -1
@@ -13,7 +13,7 @@#define BITRATE_MAX 160000000#define BITRATE_STEP 100 -static struct platform_inst_fw_cap inst_fw_cap_sm8250_dec[] = { +static const struct platform_inst_fw_cap inst_fw_cap_sm8250_dec[] = { { .cap_id =PIPE ,/* .max, .min and .value are set via platform data */
Signature · 1 line
2.47.3
Re: [PATCH v5 16/16] media: iris: constify inst_fw_cap_sm8250_dec
Quoted 7 lines · Dmitry Baryshkov
Mark
inst_fw_cap_sm8250_decas a const array, the data is read-only.Suggested-by Vishnu Reddy<[email protected]>Signed-off-by Dmitry Baryshkov<[email protected]>--- drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)