Summary
Your v9 VP9 VDPU381 patch (3564-media-rockchip-rkvdec-vdpu381-add-vp9-support-v9.patch) inherits two bugs from dvab-sarma's original code that cause visual artifacts at resolutions above 1080p.
We tested on RK3588 (Rock 5B+, kernel 7.0-rc3+) with Chromium V4L2 stateless decode. VP9 works perfectly at 720p/1080p but shows corruption at 2K+.
I also reported this upstream to dvab-sarma: dvab-sarma/android_kernel_rk_opi#3
Bug #1 (CRITICAL): Altref vertical scale copy-paste error
In config_registers(), at the scale calculation loop:
case 2:
regs->vp9_param.reg92.vp9_aref_hor_scale = hscale;
regs->vp9_param.reg93.vp9_aref_ver_scale = hscale; // BUG: should be vscale
break;
Cases 0 and 1 correctly use vscale for vertical. Case 2 (altref) copies hscale instead. This causes incorrect reference frame scaling when the altref has different dimensions from the current frame.
One-line fix:
- regs->vp9_param.reg93.vp9_aref_ver_scale = hscale;
+ regs->vp9_param.reg93.vp9_aref_ver_scale = vscale;
Bug #2: Segmap buffer overflow at 4K
#define RKVDEC_VP9_MAX_SEGMAP_SIZE 73728
Segmap size = ceil(w/64) * ceil(h/64) * 64. At 4K this is 130,560 bytes, exceeding 73728. This causes buffer overflow and potential memory corruption.
Fix: Increase to 524288 for 8K safety.
NOT bugs (we investigated these too)
- Missing
yuv_virstride: VDPU381 doesn't have this register (confirmed by checking H.264/HEVC backends)
- Missing
lastref_yuv_virstride: Same — hardware design difference from VDPU2
Test setup
- Rock 5B+ (RK3588), kernel 7.0-rc3+, Mesa 26.0.3, Chromium 148 V4L2 zero-copy
- Beryllium OS (ex-BredOS)
— Sav (dongioia @ beryllium-org)
Summary
Your v9 VP9 VDPU381 patch (
3564-media-rockchip-rkvdec-vdpu381-add-vp9-support-v9.patch) inherits two bugs from dvab-sarma's original code that cause visual artifacts at resolutions above 1080p.We tested on RK3588 (Rock 5B+, kernel 7.0-rc3+) with Chromium V4L2 stateless decode. VP9 works perfectly at 720p/1080p but shows corruption at 2K+.
I also reported this upstream to dvab-sarma: dvab-sarma/android_kernel_rk_opi#3
Bug #1 (CRITICAL): Altref vertical scale copy-paste error
In
config_registers(), at the scale calculation loop:Cases 0 and 1 correctly use
vscalefor vertical. Case 2 (altref) copieshscaleinstead. This causes incorrect reference frame scaling when the altref has different dimensions from the current frame.One-line fix:
Bug #2: Segmap buffer overflow at 4K
Segmap size =
ceil(w/64) * ceil(h/64) * 64. At 4K this is 130,560 bytes, exceeding 73728. This causes buffer overflow and potential memory corruption.Fix: Increase to 524288 for 8K safety.
NOT bugs (we investigated these too)
yuv_virstride: VDPU381 doesn't have this register (confirmed by checking H.264/HEVC backends)lastref_yuv_virstride: Same — hardware design difference from VDPU2Test setup
— Sav (dongioia @ beryllium-org)