Bug 94471

Summary: Tonga UVD 4Kx4K = failed to allocate a buffer
Product: Mesa Reporter: Andy Furniss <adf.lists>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: 4082 fails
4080 works

Description Andy Furniss 2016-03-10 00:21:27 UTC
I see >= tonga uvd height has recently been increased -

https://cgit.freedesktop.org/mesa/mesa/commit/?id=353a4f844f9e845dad93de9c28fa0d484b4b92d3

radeon/uvd: increase max height to 4096 for VI and newer
With this issue 'mpv --hwdec=vdpau --vo=vdpau <stream>' fails
for vdpau decode if the stream height is 4096. Vdpau decode of
height upto 4096 is necessary usecase on amdgpu driver for VI
and newer platforms.

The fix is in driver specific implementation of "Decoder
Query Capabilities" API to return 4096 for VI and newer
platforms. With this fix vdpauinfo reports height support as
4096 and mpv for vdpau decode works fine for 4096 height streams.

On agd5f drm-fixes-4.5 4096x4096 fails for me (also fails with --vo vdpau)


andy [~]$ mpv --hwdec=vdpau /mnt/sdb1/ffmpeg-mpl-tests/x264-4096.mkv 
Playing: /mnt/sdb1/ffmpeg-mpl-tests/x264-4096.mkv
 (+) Video --vid=1 (*) (h264)
amdgpu: Failed to allocate a buffer:
amdgpu:    size      : 0 bytes
amdgpu:    alignment : 4096 bytes
amdgpu:    domains   : 2
amdgpu: Failed to allocate a buffer:
amdgpu:    size      : 0 bytes
amdgpu:    alignment : 4096 bytes
amdgpu:    domains   : 2
EE radeon_uvd.c:1109 ruvd_create_decoder UVD - Can't allocated bitstream buffers.
[vo/opengl/x11] Disabling screensaver failed (-1). Make sure the xdg-screensaver script is installed.
Using software decoding.
VO: [opengl] 4096x4096 => 7282x4096 yuv420p

dmesg

[ 8308.529176] [TTM] Illegal buffer object size
[ 8308.529210] [drm:amdgpu_gem_object_create [amdgpu]] *ERROR* Failed to allocate GEM object (0, 2, 4096, -22)
[ 8308.529326] [TTM] Illegal buffer object size
[ 8308.529339] [drm:amdgpu_gem_object_create [amdgpu]] *ERROR* Failed to allocate GEM object (0, 2, 4096, -22)
Comment 1 Christian König 2016-03-10 08:17:46 UTC
Hi Andy,

sounds like the estimated bitstream buffer size doesn't fit into a 32bit integer any more.

Where can I download such a stream for testing?

Thanks,
Christian.
Comment 2 Andy Furniss 2016-03-10 12:22:20 UTC
(In reply to Christian König from comment #1)
> Hi Andy,
> 
> sounds like the estimated bitstream buffer size doesn't fit into a 32bit
> integer any more.
> 
> Where can I download such a stream for testing?

I wondered that myself so I made one with ffmpeg/libx264.

Further testing shows that 4080x4080 works and >= 4082x4082 fails.

I tried getting libx264 to make constrained baseline but no difference.

These 2 were made like 

ffmpeg -i a-2160p60.mkv -vf scale=w=4080:h=4080 -c:v libx264 -vframes 10  x264-4080.mkv

as they are only 10 frames tested like -

mpv --speed=0.1 -fs --hwdec=vdpau x264-4080.mkv

While here a shameless bump of a similar VCE issue :-)

I don't know the precise fail point for VCE but 3840x2160 fails 2560x1440 works.

https://bugs.freedesktop.org/show_bug.cgi?id=91281
Comment 3 Andy Furniss 2016-03-10 12:23:36 UTC
Created attachment 122202 [details]
4082 fails
Comment 4 Andy Furniss 2016-03-10 12:24:34 UTC
Created attachment 122203 [details]
4080 works
Comment 5 Andy Furniss 2016-03-10 13:00:06 UTC
Of course those are square - It is possible to get height 4096 working as long as width is lower than 4082.
Comment 6 Andy Furniss 2016-07-04 14:45:55 UTC
Mesa commit 

commit 51227b41c6b026f5b0a3925093b91800cdfcc923
Author: Indrajit Das <indrajit-kumar.das@amd.com>
Date:   Fri May 27 18:27:15 2016 +0530

    radeon/uvd: fix overflow error while calculating bit stream buffer size


gets rid of the errors and so mpv/mplayer will attempt to use uvd, but no video is displayed, just a black screen.
Comment 7 GitLab Migration User 2019-09-25 17:54:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1230.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.