redroid-doc icon indicating copy to clipboard operation
redroid-doc copied to clipboard

add optimized h264 encoder / OMXPlugin (x264 with gles pipeline)

Open zhouziyang opened this issue 4 years ago • 17 comments

currently, media codec performance is poor (high cpu usage for copying frames from GPU). plan to optimize this scenario (render on GPU, while encoding with CPU)

For encoding with GPU, some options are available (VAAPI etc.). And this is platform dependent, and users should optimize at their own needs.

zhouziyang avatar Jan 26 '22 03:01 zhouziyang

当前的redroid-11.0.0 版本, h264编码已完成优化了吗,是否可以支持h264 硬件编码及GPU 渲染?

JohnnyShu avatar Apr 06 '22 10:04 JohnnyShu

硬件编码方需要根据平台选择去优化。开源方案 AMD GPU是可以做硬件编码加速的

zhouziyang avatar Apr 07 '22 04:04 zhouziyang

我们的服务器是AMD 架构的 “5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux (buildd@lgw01-amd64-052) ” 但我们的视频通信服务运行的时间mediacodec 进行cpu 利用率较用高达 50%左右; image

开源方案 ADM 架构似乎默认没有开启GPU 硬件编码加速, 需要如何开启 呢?

JohnnyShu avatar Apr 07 '22 07:04 JohnnyShu

当我尝试使用 redroid.gpu.mode=host 打开 gpu 加速时,收到 如下错误: 253707722f409faf41fe72f435c282f8

JohnnyShu avatar Apr 07 '22 08:04 JohnnyShu

是否同时还需要指定 redroid.gpu.node ,当指定 redroid.gpu.node=/dev/dri/card0 时,还是出现surfacelinger 无法启动: 615d13411d5cfa16de67e424ebc1881e 另外, 为什么 我的系统 不存在 /dev/dri/renderDxxx 设备? 只有 card0 device; image

JohnnyShu avatar Apr 07 '22 08:04 JohnnyShu

mediacodec 开源方案没有做优化,系统没有GPU吧?技术上 Intel / AMD / Nvidia 3D渲染和编解码都可以实现硬件加速

zhouziyang avatar Apr 07 '22 15:04 zhouziyang

image Host 虚拟机应该是有GPU 的呢。 不知为何 容器里的Redroid 访问不到DRM device? 另外, 开源方案的Mediacodec 需要怎么使能硬件编码加速呢, 除了开启GPU 外还需要其它优化,包括哪些点呢?

JohnnyShu avatar Apr 08 '22 02:04 JohnnyShu

llvmpipe used, seems no GPU detected.

zhouziyang avatar Apr 08 '22 05:04 zhouziyang

是的, /dev/dri 目录下没有找到GPU VAAPI 设备文件。我检测一下VAAPI 驱动。 image

JohnnyShu avatar Apr 11 '22 07:04 JohnnyShu

image image image redroid 运行指定[ro.kernel.redroid.gpu.node]: [/dev/dri/renderD128], 但运行是却报EGL-MAIN: failed to open /dev/dri/renderD129: Permission denied, 何故呢?

JohnnyShu avatar May 18 '22 04:05 JohnnyShu

chmod 666 /dev/dri/renderD129, mode should be changed by gpu_config.sh

zhouziyang avatar May 19 '22 01:05 zhouziyang

Thanks for reply, let me try.

JohnnyShu avatar May 19 '22 02:05 JohnnyShu

got root cause: my gpu driver is nouveau, it not case in “case $driver in i915|amdgpu|virtio_gpu|v3d|vc4|msm|panfrost)”。

JohnnyShu avatar May 19 '22 02:05 JohnnyShu

have chmod 666 for /dev/dri/renderD129, now get "failed to open nouveau: dlopen failed: library "/vendor/lib64/dri/nouveau_dri.so" fault, if redroid support nouveau driver? image

JohnnyShu avatar May 19 '22 11:05 JohnnyShu

and how to confirm that gpu is enabled?

JohnnyShu avatar May 19 '22 13:05 JohnnyShu

nouveau still encounter some issues, thus not enabled.

check via dumpsys SurfaceFlinger | grep GLES swiftshader or Angle is software based. otherwise GPU is enabled

zhouziyang avatar May 20 '22 03:05 zhouziyang

f000c2aa5ab7:/ # dumpsys SurfaceFlinger | grep GLES GLES: Intel, Mesa Intel(R) UHD Graphics 630 (CML GT2), OpenGL ES 3.2 Mesa 22.0.0-devel

It is seem has enable intel gpu renderer. another two question is: 1, how to use the intel gpu to accelerate h264 encode? 2, I have another nvidia in host, if redroid support nvidia gpu device now?

JohnnyShu avatar May 20 '22 08:05 JohnnyShu