Skip to contentSkip to conversation

Tonga VCE 2160p encode fails with BO to small for addr

Bug 91281 [email protected] 1 participant 8 messages Jul 9, 2015 – Dec 6, 2016

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=91281

Bug ID: 91281
Summary: Tonga VCE 2160p encode fails with BO to small for
addr
Product: DRI
Version: XOrg git
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: DRM/AMDgpu
Assignee: [email protected]
Reporter: [email protected]

I don't know what the VCE is supposed to do on this R9 285 card but testing with 2160p gives.

amdgpu: The CS has been rejected, see dmesg for more information.

[drm:amdgpu_vce_cs_reloc [amdgpu]] *ERROR* BO to small for addr 0x0002450000 14 13

Same test works with 1080p (bit slow but I haven't tested/understood the PM situation yet).

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #1 from Andy Furniss <[email protected]> --- Now that vaapi is enabled the situation with this is more mixed.

omx still just always fails.

ffmpeg vaapi always works.

gatreamer vaapi fails or works depending on framerate, which is a bit confusing.

For 2160p as long as I say framerate <=30 it works. For 4096x2160 it has to be <=26.

Adding size to the kernel error message shows that the failing size = 2x raw framesize -

[drm:amdgpu_vce_cs_reloc [amdgpu]] *ERROR* BO to small for addr 0x0108fde000 14 13 24883200

Adding debugging to vlVaCreateBuffer doesn't show any difference between working and failing cases - the size requested being one raw frame.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #2 from Andy Furniss <[email protected]> --- More debugging and size 24883200 works fine in the working case, it's

mapping->it.last

that varies between working and failing.

                    size     mapping->it.last

0x0108fde000 14 13 24883200 1101026 = OK

0x0108fde000 14 13 24883200 1088786 = fail

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #3 from Andy Furniss <[email protected]> --- I know what causes this now.

It's the get_cpb_num case statement in radeon_vce.c.

It only handles up to 51 and defaults to 42.

ffmpeg lucked into working because it calls 51 when it should really be 52.

gstreamer vaapi calls correctly so only > 2160p30 fails as 52 gets default.

gstreamer omx always fails because it seems to max at 42.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #4 from Christian König <[email protected]> --- Nice catch. Brave enough to provide a patch or should Leo and I take a look?

I'm just back from vacation and so busy that I probably won't come to it before the end of the month.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #5 from Andy Furniss <[email protected]> --- I can do a patch, but I'll need time to think/look/test more.

First thought = easy just add 52 and maybe make default vary with chip type as done elsewhere, will fix gst-vaapi, but not going to help OMX.

Initial testing/looking it seems gst-omx doesn't go up to 5.2 plus gstreamer (or me + gstreamer) doesn't seem able to pass level anyway so it picks it up from the state tracker default - 4.2, changing this to 5.1 gets me 2160p encoding - but I guess I can't do anything platform specific in there.

Maybe if fps is available in addition to width/height in radeon_vce.c ignore what level is sent by player as they may be wrong/not say anyway and work it out?

Of course I don't currently know if this is possible, what implications there may be and what to do about different hardware capabilities.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

--- Comment #6 from Andy Furniss <[email protected]> ---
Maybe if enc->base.level is unreliable I shouldn't trust enc->base.max_references either, but it seems that the h/w gets set up using it -

radeon_vce_40_2_2.c
RVCE_CS(MAX2(enc->base.max_references, 1) - 1); // encBPicPattern RVCE_CS(MIN2(enc->base.max_references, 2)); // encNumberOfReferenceFrames RVCE_CS(enc->base.max_references + 1); // encMaxNumRefFrames

radeon_vce_52.c:
enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 1; enc->enc_pic.pc.enc_number_of_reference_frames = MIN2(enc->base.max_references, 2);
enc->enc_pic.pc.enc_max_num_ref_frames = enc->base.max_references + 1;

So unless I miss something the whole function body of get_cpb_num could be replaced with just

return MIN2(enc->base.max_references + 1, 16);

It works testing wise with level 5.2 and doesn't need the level given by the encoder/omx state tracker to be correct. It also saves allocating buffers that aren't really used.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=91281

Andy Furniss <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Andy Furniss <[email protected]> --- Fixed in mesa

https://cgit.freedesktop.org/mesa/mesa/commit/?id=5338fb34d6af656adaf0c80d57b5a6168f81d3e1

https://cgit.freedesktop.org/mesa/mesa/commit/?id=2a38a5b2b28aa6e2c5c005bf5a2bfeae11623f22

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel