steam-for-linux icon indicating copy to clipboard operation
steam-for-linux copied to clipboard

Use hardware encoding on AMD RX480 for In-Home Streaming.

Open toojays opened this issue 9 years ago • 118 comments

My GPU is an RX 480. When streaming to the steam link from Linux, my streaming_log.txt shows:

[2017-03-09 22:54:10] >>> Capture method set to Desktop OpenGL NV12 + scale + libx264 main (3 threads)
[2017-03-09 22:54:10] >>> Capture resolution set to 1280x720

Whereas from Windows, I get:

[2017-01-12 06:55:24] >>> Capture method set to Steam D3D10 NV12 + AMF H264
[2017-01-12 06:55:24] >>> Capture resolution set to 1920x1080

Unsurprisingly, I get a better picture, and smoother performance when streaming from Windows.

Recent versions of Mesa support hardware encoding of H264 on this GPU:

┌(toojays@kano)─(9993)─(0)─(2017 03 10 20:16:12)
└─(~)─> vainfo | grep Entry
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      <unknown profile>               :	VAEntrypointVLD
      <unknown profile>               :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

Please enhance the Steam Linux client to take advantage of this for streaming to the Steam Link.

toojays avatar Mar 10 '17 10:03 toojays

Hello @toojays, there shouldn't be a distinction in the steam client between this video card and other AMD cards that use mesa. You may want to confirm that hardware encoding is enabled in the Advanced Host Options of the In-Home Streaming settings.

kisak-valve avatar Mar 10 '17 14:03 kisak-valve

We don't currently support VA-API for encoding, but it's a valid feature request, thanks.

Plagman avatar Mar 10 '17 18:03 Plagman

@kisak-valve, are you saying hardware encoding is supported on this card? Perhaps by some means other than VA-API?

It do have it enabled in the settings. I have not seen any report of any Linux user having hardware encoding working on any AMD GPU, so have assumed it is not supported. Which is consistent with Plagman's comment, unless perhaps it's supported with the proprietary drivers or something. I asked about the requirements for it at http://steamcommunity.com/groups/homestream/discussions/0/1842367319523385800/ and heard nothing.

toojays avatar Mar 13 '17 10:03 toojays

@toojays, all I said was that the RX 480 model should currently have the same support as other AMD video cards using mesa, nothing more.

kisak-valve avatar Mar 13 '17 14:03 kisak-valve

It sounds like that for now that support is limited to there being a tantalizing checkbox which does nothing. ;)

I look forward to that checkbox being wired up to enable actual hardware encoder support code at some point in the future.

toojays avatar Mar 13 '17 22:03 toojays

That checkbox does enable other backends such as NVENC, but nothing that currently works on Mesa to my knowledge.

Plagman avatar Mar 13 '17 23:03 Plagman

Can anyone enumerate the roadblocks for this feature here?

xenithorb avatar Dec 13 '17 14:12 xenithorb

I see the same behavior on an AMD Radeon R9 Nano with the current AMDGPU-Pro drivers. It also supports H.264 encoding via VA-API:

~$ vainfo
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

When using the "beautiful" option in FullHD, the PC I want to use it on, reports a load of 300 %. This means that the CPU resources of my Phenom II X6 1090t get cut in half:

bildschirmfoto vom 2018-01-04 20-25-13

The significantly increased power consumption of the software encoding causes more noise output. My PC screaming after me impairs the success of Steam Link of moving away from it. To me, this makes Steam Link kind of pointless.

In the performance overlay on the Steam Link, I the frame rate drop from 60 to 30 or even lower when much of the screen content changes quickly. When I start a 3D game, it runs fine if at only 30 FPS on the host PC, but Steam Link sees 1 % packet loss, which results in 40 % frame drops and is obviously unplayable. Steam Link estimates the bandwidth of my Gigabit switch at up to 68 MBit/s, so that does not seem to be cause of the the issue.

Bengt avatar Jan 04 '18 20:01 Bengt

The massive benefit enabling hardware video encoding under Linux would have for users like me can be seen in the response to enabling it under Windows for AMD cards:

https://steamcommunity.com/app/353380/discussions/0/451852225141685452/#c365163686049333645

Bengt avatar Jan 05 '18 00:01 Bengt

@kisak-valve On what you mentioned, what kind of support do AMD-gpu's (using mesa) have?

RlndVt avatar Jan 25 '18 18:01 RlndVt

All @kisak-valve was saying is that this issue is not specific to the rx480 as the title says.

All AMD GPUs on mesa use VA-API for hardware encoding and steam doesn't support VA-API for encoding at the moment.

@plagman should there perhaps be a seperate issue created to feature request VA-API encoding support?

alexmaras avatar Jan 31 '18 23:01 alexmaras

I asked because there is also vdpau encoding, and maybe that is supported.

I do agree on creating a separate, or rather renaming this issue, specifically for VA-API.

RlndVt avatar Feb 01 '18 18:02 RlndVt

Has there been any update on this issue recently?

That is, are we close to being able to use hardware encoding on AMD hardware yet?

edenist avatar May 28 '18 04:05 edenist

I'm trying to get hardware encoding on a Ryzen 2200G under Ubuntu 18.04 with the 4.16.12+ kernel from here and MESA drivers from here. I installed the necessary :i386 packages, but only have stuttering software encoding. vainfo tells me VA-API 1.1 is installed and H264 Main/High are available... Anything I could try?

HorstBaerbel avatar May 29 '18 16:05 HorstBaerbel

@HorstBaerbel You might want to read the ticket more thoroughly, particularly https://github.com/ValveSoftware/steam-for-linux/issues/4890#issuecomment-362106453 . All AMD GPU owners (that includes Ryzen+Vega combo) are currently out of luck, until Steam devs implement support for them.

kparal avatar May 29 '18 17:05 kparal

This is really annoying honestly. I just finished setting up my streaming network and this encode issue has been a pain in the butt.

GitThisBugOff avatar May 29 '18 18:05 GitThisBugOff

Same issue, was testing streaming and noticed the substantial CPU usage, looked in to it and no hardware encoding was being performed on a Vega card, which was a bit wtf'ery, then found this issue. Why on earth would a proprietary useless one like NVENC be built in but the linux standard(s?) VA-API not being supported is a bit astounding... >.>

OvermindDL1 avatar May 29 '18 19:05 OvermindDL1

Yup, it's definitely a glaring outstanding feature in an otherwise great offering. It would be great to see some progress in this area. I'm sure there are many of us AMd users in the community who would be glad to help out.

edenist avatar May 30 '18 03:05 edenist

@karpal You might be right, but what confused me is that VA-API is already being used for hardware decode (on my Laptop with an Intel HD 620 iGPU though), so having VA-API support for encoding too only seemed logical... The issue is a year old and probably relevant much longer already. If the client (sans the DRM/protection parts) would be open-source, somebody would have fixed it already. But using Github to open a bug tracker without any source in it feels a bit half-hearted to me anyway...

Btw: Is it possible to render games on one GPU and use an extra (e.g. cheap Nvidia) GPU for encoding?

HorstBaerbel avatar May 30 '18 07:05 HorstBaerbel

Btw: Is it possible to render games on one GPU and use an extra (e.g. cheap Nvidia) GPU for encoding?

Hmm, this is an interesting idea. Some searching online shows that it is somewhat doable with an AMD primary, then adding an nvidia card and installing the drivers with the --no-opengl-files option which should make sure it isn't overwriting anything display related. That said, this info is generally for people doing compute-type work. We would have to check if this would install NVENC and make it usable.

It then depends on how steam detects encoding options. It all might be for nothing if it only checks the current display GPU then falls back to software.

I don't have any nvidia GPU available at the moment, but I'll poke around on ebay etc to see if I can find something for cheap.

edenist avatar Jun 01 '18 05:06 edenist