GPUOpen-LibrariesAndSDKs / AMF

The Advanced Media Framework (AMF) SDK provides developers with optimal access to AMD devices for multimedia processing
Other
600 stars 151 forks source link

Samples not working on Linux build - Pro stack required #130

Closed parkerlreed closed 5 years ago

parkerlreed commented 6 years ago
lib32-vulkan-icd-loader 1.1.82+2958+1f9a54573-1
lib32-vulkan-radeon-git 104519.2c1f249f2b-1
spirv-tools 2018.4-1
vkcube-git r119.0d57034-1
vulkan-extra-layers 1.1.82+10205+94ac68e53-1
vulkan-headers 1:1.1.82+97+c4e056d-1
vulkan-html-docs 1:1.1.83-1
vulkan-icd-loader 1.1.82+2958+1f9a54573-1
vulkan-radeon-git 104519.2c1f249f2b-1
vulkan-tools 1.1.82+6821+ca05ec7c-1
vulkan-trace 1.1.82+10205+94ac68e53-1
vulkan-validation-layers 1.1.82+7759+0cb86f5f-1
lib32-mesa-demos 8.4.0-1
lib32-mesa-git 104519.2c1f249f2b-1
mesa-demos 8.4.0-1
mesa-git 104519.2c1f249f2b-1
opencl-mesa-git 104519.2c1f249f2b-1
glslang 7.8.2853-1

vulkaninfo http://ix.io/1m68

In amf/public/samples I ran

VK_SDK_PATH=/usr/include/vulkan make -j10

Only issue I ran into was glslangValidator was expected in VK_SDK_PATH but is in my /usr/bin

I updated the three references in the various Makefiles to point to the correct location and it built successfully.

Changed to the amf/bin/dbg_64 folder and any of the binaries I try give me

[parker@e55 dbg_64]$ ./TranscodeHW 
AMF Failed to initialize

Looking at strace I get

openat(AT_FDCWD, "/home/parker/build/AMF/amf/bin/dbg_64/libamfrt64.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Which doesn't exist

[parker@e55 dbg_64]$ ls
amf-component-ffmpeg.so  cube.frag.spv     libavdevice.so.57  libavresample.so.3  libswscale.so.4  quad.vert.spv    SimpleEncoder
build                    cube.vert.spv     libavfilter.so.6   libavutil.so.55     PlaybackHW       SimpleConverter  TranscodeHW
CapabilityManager        libavcodec.so.57  libavformat.so.57  libswresample.so.2  quad.frag.spv    SimpleDecoder    VCEEncoderD3D

Also doesn't exist anywhere in the source tree

[parker@e55 AMF]$ find . -name "libamfrt64*"
[parker@e55 AMF]$ 

Build output http://ix.io/1m6d

EDIT: The def file only mentions mesa but the libamfrt64 file seems to be exclusive to amdgpu-pro. Is the open source stack still not supported?

https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/4#issuecomment-415199921

MikhailAMD commented 6 years ago

libamfrt64.so is part of driver and installed optionally, similar to Vulkan runtime. Ffmpeg wrapper component should be built as part of sample build. Check public/samples/makefile

parkerlreed commented 6 years ago

Well it's failing because I don't have that library. How can I get that library without installing amdgpu-pro?

public/samples/Makefile is what I ran.

parkerlreed commented 6 years ago

Ok after grabbing https://www2.ati.com/drivers/linux/ubuntu/18.04/amdgpu-pro-18.30-641594.tar.xz

And then extracting the amf deb, and then extracting the libs manually and placing them in /usr/lib/ the examples do run.

[parker@e55 dbg_64]$ ./CapabilityManager 
AMF version (header):                                                             90000
AMF version (runtime):                                                            90000
CreateDeviceAndQueues() vkCreateDevice() failed, Error=0-7 Error:AMF_FAIL
CreateDeviceAndFindQueues() failed Error:AMF_FAIL

libamf seems to only be available in the Pro stack. Does it need the Pro stack to actually be active to work?

parkerlreed commented 6 years ago

I realized I wasn't using LunarG https://vulkan.lunarg.com/sdk/home

But even after cleaning everything and recompiling with that as the SDK path, still get the same Vulkan device creation failure. Vulkan elsewhere runs fine (as evident by the vulkaninfo and also vkcube)

MikhailAMD commented 6 years ago

You need Pro stack including Vulkan driver. Open source Vulkan driver will not work.

parkerlreed commented 6 years ago

Well crap. I'm on Arch and the Pro stack is a pain to setup. Thanks for the info.

ghost commented 6 years ago

Are there any plans for amdgpu support?

MikhailAMD commented 6 years ago

At this point AMF uses private extensions in Vulkan runtime, that are available in Pro stack only. There is a work by Khronos consortium to standardize encoder and decoder extensions for Vulkan. Once it is done and implemented in Vulkan runtime, AMF will support them and parts of AMF will be open-sourced in amdgpu similar to Vulkan. I don't have timeline for all this.

Lucretia commented 6 years ago

I tried this on Gentoo, I have latest (from git) llvm/clang/mesa on 4.19-rc4 kernel, I created an /tmp/include/AMF link to AMF/amf/public/include, compiled ffmpeg (from git) and installed to /tmp which built statically. I pointed a local vulkan.icd.json which pointed to the amdvlk64.so from amdgpu-pro version of the library and also created local links to libamfrt64.so to the ``amdgpu-pro``` version.

{
    "file_format_version" : "1.0.0",
    "ICD" : {
        "library_path" : "./amdvlk64.so",
        "api_version" : "1.1.70"
    }
}

My command line looks like:

VK_ICD_FILENAMES=./vulkan.icd.json LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH /tmp/bin/ffmpeg -i <input vid> -c:v h264_amf -quality quality test.mp4 -loglevel verbose

I get the following error

...other stuff snipped...
[h264 @ 0x5593bd2caf40] Reinit context to 480x368, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x5593bd4ce480] w:466 h:360 pixfmt:yuv420p tb:1/30 fr:30/1 sar:1/1 sws_param:flags=2
[h264_amf @ 0x5593bd230640] AMF initialisation failed via D3D9: error 10.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x5593bd230ec0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x5593bd20b7c0] Statistics: 191496 bytes read, 0 seeks
Conversion failed!
MikhailAMD commented 6 years ago

You are trying to run ffmpeg with AMF on Linux. This integration is not done yet. You can run AMF samples instead. But remember, you need AMD PRO driver from amd.com.

Lucretia commented 6 years ago

Neither work. Like I posted above, I have all the amdgpu-pro bits in place.

MikhailAMD commented 6 years ago

More info please, logs...

Lucretia commented 6 years ago

What logs?

MikhailAMD commented 6 years ago

You stated that samples don't work for you. I need to know the point of failure. AMF can output a lot of log/trace into into stdout, file etc. See TraceAdapter.h for configuration details.

Sur3 commented 5 years ago

I also tried using openmax for video encoding but ran into multiple problems as well, is openmax still supported or totally outdated and being replaced by amf now? https://www.phoronix.com/scan.php?page=news_item&px=MTYwMzA

MikhailAMD commented 5 years ago

AMF is supported on closed source (Pro) driver and OpenMax on open source (Mesa) driver.

MikhailAMD commented 5 years ago

Closed as stale issue