Actually, I think this version will do encode vaapi device selection
too, like this:
CIN_DRM_DEC=/dev/dri/renderD129 CIN_DRM_ENC=/dev/dri/renderD128 bin/cin
but for some reason decode via Radeon device (on pcie bus?) and encode
on integrated GPU via i965 driver much slower!
I used intel_gpu_top and radeontop (1.4 git from github) for checking
each video block load.
devices:
root@slax:~# lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor
Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core
Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation
Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200
Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset
Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset
Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 3 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 4 (rev b4)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 6 (rev b4)
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
Family PCI Express Root Port 8 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset
Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset LPC
Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series
Chipset Family 6 port Mobile SATA AHCI Controller (rev 04)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Seymour [Radeon HD 6400M/7400M Series]
24:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host
Controller (rev 30)
24:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host
Controller (rev 30)
24:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)
25:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network
Adapter (PCI-Express) (rev 01)
26:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
27:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host
Controller (rev 04)
there is modprobe.d config file
root@slax:~# cat
/mnt/live/memory/images/006_dualgpu.lzm/etc/modprobe.d/dualgpu.conf
#fixes /dev/dri order on dual gpu laptop
softdep radeon pre: i915
and Xorg.conf
cat /mnt/live/memory/images/006_dualgpu.lzm/etc/X11/xorg.conf.d/20-nouveau.conf
Section "Device"
Identifier "Card0"
# Driver "nouveau"
Option "PageFlip" "1"
Option "AccelMethod" "glamor"
Option "DRI" "3"
EndSection
main tool being DRI "3" line.
kernel
uname -a
Linux slax 5.6.14-x64 #1 SMP PREEMPT Thu May 21 23:01:18 MSK 2020
x86_64 Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz GenuineIntel GNU/Linux
X server 1.20.13
va-api driver #1
vainfo --display drm
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Sandybridge
Mobile - 1.8.3
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
vaapi driver #2:
DRI_PRIME=1 LIBVA_DRIVER_NAME=r600 vainfo --display drm --device
/dev/dri/renderD129
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Mesa Gallium driver 23.2.0-devel for AMD
CAICOS (DRM 2.50.0 / 5.6.14-x64, LLVM 16.0.6)
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
i965 driver from 1.8 branch
=====
hm, so it also works slow with just Intel device. But may be this is
because I run whole thing with remote display via ssh!
On Sat, Aug 26, 2023 at 10:45 AM Andrew Randrianasulu
<[email protected]> wrote:
>
> Because I have this dual-gpu laptop with intel and radeon (r600)
> decoding devices I tried to get second (mesa/r600) device going but
> init failed .. I looked into decoding example:
>
>
> https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e
>
> and created attached patch
>
> now you can select your specific device with env variable:
>
> CIN_DRM_DEC=/dev/dri/renderD129 DRI_PRIME=1 LIBVA_DRIVER_NAME=r600 bin/cin
>
> in theory same treatment can be applied (with different variable name)
> to second instance of av_hwdevice_ctx_create (in hw encoder init) but
> I have no device to test it ...
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 4923eded..e95cc87e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -1160,7 +1160,14 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
if( hw_pix_fmt >= 0 ) {
hw_pixfmt = hw_pix_fmt;
avctx->get_format = get_hw_format;
+ const char *drm_node = getenv("CIN_DRM_DEC");
+ if(drm_node && type==AV_HWDEVICE_TYPE_VAAPI) {
+ ret = av_hwdevice_ctx_create(&hw_device_ctx, type, drm_node, 0, 0);
+ }
+ else {
ret = av_hwdevice_ctx_create(&hw_device_ctx, type, 0, 0, 0);
+ }
+
if( ret >= 0 ) {
avctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
ret = 1;
@@ -1176,6 +1183,7 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
{
+ const char *drm_node_enc = getenv("CIN_DRM_ENC");
AVBufferRef *hw_device_ctx = 0;
AVBufferRef *hw_frames_ref = 0;
AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE;
@@ -1187,7 +1195,12 @@ AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
}
}
if( type != AV_HWDEVICE_TYPE_NONE ) {
- int ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, 0, 0, 0);
+ int ret = 0;
+ if (drm_node_enc) {
+ ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, drm_node_enc, 0, 0);
+ } else {
+ ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, 0, 0, 0);
+ }
if( ret < 0 ) {
ff_err(ret, "Failed to create a HW device.\n");
type = AV_HWDEVICE_TYPE_NONE;
--
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin