kmsgrab on non primary card, libva/hwmap advice?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

kmsgrab on non primary card, libva/hwmap advice?

test
Hi All. Thanks in advance for any assistance provided.

I've been trying to get kmsgrab to work on my second rx570.
Aim is to record multiple framebuffers on both cards. Both cards are
maxed in terms of CRTC's, so switching all to one card isn't an
option. x11grab has not been performant enough.

I have three "cards":

/dev/dri/card0 -> intel iGPU
/dev/dri/card1 -> rx 570
/dev/dri/card2 -> rx 570

I have card1 working fine, it's the primary card. I haven't tried card0.

/home/test/.local/bin/ffmpeg  -framerate 60 -device /dev/dri/card1  -f
kmsgrab  -i - -vf 'hwmap=derive_device=vaapi,hwdownload,format=bgr0'
/home/test/card1.mp4

Whilst trying for card2 and a similar command I get errors.
I've tried advice under https://trac.ffmpeg.org/wiki/Hardware/VAAPI
regarding device selection.
The error doesn't change?

./ffmpeg -init_hw_device
vaapi=foo:/dev/dri/by-path/pci-0000\:02\:00.0-render
-filter_hw_device foo -framerate 60 -device /dev/dri/card2  -f kmsgrab
 -i - -vf 'hwmap=
derive_device=vaapi,hwdownload,format=bgr0' /home/test/card2.mp4

Any advice would be appreciated.
Cheers.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

card1_text_output_example (6K) Download Attachment
card2_text_output_error_example (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: kmsgrab on non primary card, libva/hwmap advice?

Mark Thompson
On 30/01/2020 11:00, test wrote:

> Hi All. Thanks in advance for any assistance provided.
>
> I've been trying to get kmsgrab to work on my second rx570.
> Aim is to record multiple framebuffers on both cards. Both cards are
> maxed in terms of CRTC's, so switching all to one card isn't an
> option. x11grab has not been performant enough.
>
> I have three "cards":
>
> /dev/dri/card0 -> intel iGPU
> /dev/dri/card1 -> rx 570
> /dev/dri/card2 -> rx 570
>
> I have card1 working fine, it's the primary card. I haven't tried card0.
>
> /home/test/.local/bin/ffmpeg  -framerate 60 -device /dev/dri/card1  -f
> kmsgrab  -i - -vf 'hwmap=derive_device=vaapi,hwdownload,format=bgr0'
> /home/test/card1.mp4
>
> Whilst trying for card2 and a similar command I get errors.
> I've tried advice under https://trac.ffmpeg.org/wiki/Hardware/VAAPI
> regarding device selection.
> The error doesn't change?
libva has some weird issues with KMS devices which aren't master, and the behaviour might well change between cards in one session depending on which one it decided was the main one.

I think you're on the right track with this:

> ./ffmpeg -init_hw_device
> vaapi=foo:/dev/dri/by-path/pci-0000\:02\:00.0-render
> -filter_hw_device foo -framerate 60 -device /dev/dri/card2  -f kmsgrab
>  -i - -vf 'hwmap=
> derive_device=vaapi,hwdownload,format=bgr0' /home/test/card2.mp4
but it isn't quite there.  The derive_device option asks it to make a new VAAPI device from the KMS/DRM device you have on input rather than using the one on the render device which you created first.

So, try removing the derive_device option from hwmap:

./ffmpeg -init_hw_device vaapi=foo:/dev/dri/by-path/pci-0000\:02\:00.0-render -filter_hw_device foo -framerate 60 -device /dev/dri/card2 -f kmsgrab -i - -vf 'hwmap,hwdownload,format=bgr0' /home/test/card2.mp4

which will then map to your already-created VAAPI render device.

(I assume you've checked carefully that that PCI path matches the right card; it certainly looks plausible to me.)

- Mark
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: kmsgrab on non primary card, libva/hwmap advice?

test
On Sun, 2 Feb 2020 at 08:19, Mark Thompson <[hidden email]> wrote:

>
> On 30/01/2020 11:00, test wrote:
> > Hi All. Thanks in advance for any assistance provided.
> >
> > I've been trying to get kmsgrab to work on my second rx570.
> > Aim is to record multiple framebuffers on both cards. Both cards are
> > maxed in terms of CRTC's, so switching all to one card isn't an
> > option. x11grab has not been performant enough.
> >
> > I have three "cards":
> >
> > /dev/dri/card0 -> intel iGPU
> > /dev/dri/card1 -> rx 570
> > /dev/dri/card2 -> rx 570
> >
> > I have card1 working fine, it's the primary card. I haven't tried card0.
> >
> > /home/test/.local/bin/ffmpeg  -framerate 60 -device /dev/dri/card1  -f
> > kmsgrab  -i - -vf 'hwmap=derive_device=vaapi,hwdownload,format=bgr0'
> > /home/test/card1.mp4
> >
> > Whilst trying for card2 and a similar command I get errors.
> > I've tried advice under https://trac.ffmpeg.org/wiki/Hardware/VAAPI
> > regarding device selection.
> > The error doesn't change?
> libva has some weird issues with KMS devices which aren't master, and the behaviour might well change between cards in one session depending on which one it decided was the main one.
>
> I think you're on the right track with this:
>
> > ./ffmpeg -init_hw_device
> > vaapi=foo:/dev/dri/by-path/pci-0000\:02\:00.0-render
> > -filter_hw_device foo -framerate 60 -device /dev/dri/card2  -f kmsgrab
> >  -i - -vf 'hwmap=
> > derive_device=vaapi,hwdownload,format=bgr0' /home/test/card2.mp4
> but it isn't quite there.  The derive_device option asks it to make a new VAAPI device from the KMS/DRM device you have on input rather than using the one on the render device which you created first.
>
> So, try removing the derive_device option from hwmap:
>
> ./ffmpeg -init_hw_device vaapi=foo:/dev/dri/by-path/pci-0000\:02\:00.0-render -filter_hw_device foo -framerate 60 -device /dev/dri/card2 -f kmsgrab -i - -vf 'hwmap,hwdownload,format=bgr0' /home/test/card2.mp4

Just confirming here for future users.
This did the trick.
Thanks for the explanation.

>
> which will then map to your already-created VAAPI render device.
>
> (I assume you've checked carefully that that PCI path matches the right card; it certainly looks plausible to me.)

Yes. In hindsight perhaps I could have matched the -card and -render
paths to make it clear.
Thanks for the feedback.

>
> - Mark
> __

Cheers.
_____________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".