Skip to content

Instantly share code, notes, and snippets.

@nickdiego
Created November 30, 2021 04:15
Show Gist options
  • Save nickdiego/423ac00c7d4b1d5580603d04a209838a to your computer and use it in GitHub Desktop.
Save nickdiego/423ac00c7d4b1d5580603d04a209838a to your computer and use it in GitHub Desktop.
Chromium WebRTC issue

VAAPI video decoding

  • GN arg: use_vaapi = true
  • Runtime args:
  --enable-features=UseOzonePlatform,VaapiVideoDecoder
  --ozone-platform={x11,wayland}
  --use-gl=egl
  --ignore-gpu-blocklist
  --vmodule='gpu_video*=1,vaapi*=10,interface_factory_impl=10'
  • Verification:
    • In order to ensure VDA Video Decoder is used, open an youtube video, for example, and while it's playing, on the Developer Tools "Media" tab, select the youtube player and check the Video Decoder > Decoder Name property is VdaVideoDecoder.

Ozone/X11

  1. Vulkan-related crashes when trying to play back an youtube video with the following command:
out/linux/chrome \
  --enable-logging=stderr \
  --no-sandbox \
  --user-data-dir=test \
  --enable-features=UseOzonePlatform,VaapiVideoDecoder \
  --ozone-platform=x11 \
  --use-gl=egl \
  --ignore-gpu-blocklist \
  --vmodule="gpu_video*=1,vaapi*=10"
  "https://www.youtube.com/watch?v=joat8DME_UI" 

Stack trace:

Received signal 4 ILL_ILLOPN 7fea7df423ef
#0 0x7fea87b7d549 base::debug::CollectStackTrace()
#1 0x7fea87a78603 base::debug::StackTrace::StackTrace()
#2 0x7fea87b7cfd1 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7fea760b5870 (/usr/lib/libpthread-2.33.so+0x1386f)
#4 0x7fea7df423ef media::GetPlatformSupportedVideoDecoderConfigs()
#5 0x7fea7df14e17 media::GpuMojoMediaClient::GetSupportedVideoDecoderConfigs()
#6 0x7fea7df30010 media::MojoVideoDecoderService::GetSupportedConfigs()
#7 0x7fea7df7e4df media::mojom::VideoDecoderStubDispatch::AcceptWithResponder()
#8 0x7fea873b4721 mojo::InterfaceEndpointClient::HandleValidatedMessage()
#9 0x7fea873ba9f3 mojo::MessageDispatcher::Accept()
#10 0x7fea873b62bd mojo::InterfaceEndpointClient::HandleIncomingMessage()
#11 0x7fea873c0767 mojo::internal::MultiplexRouter::ProcessIncomingMessage()
#12 0x7fea873bfb0e mojo::internal::MultiplexRouter::Accept()
#13 0x7fea873baa2f mojo::MessageDispatcher::Accept()
#14 0x7fea873ad3b9 mojo::Connector::DispatchMessage()
#15 0x7fea873ae080 mojo::Connector::ReadAllAvailableMessages()
#16 0x7fea873ade49 mojo::Connector::OnWatcherHandleReady()
#17 0x7fea873ae790 mojo::SimpleWatcher::DiscardReadyState()
#18 0x7fea8735a02c mojo::SimpleWatcher::OnHandleReady()
#19 0x7fea8735a512 base::internal::Invoker<>::RunOnce()
#20 0x7fea87b0e4b9 base::TaskAnnotator::RunTaskImpl()
#21 0x7fea87b48a17 base::internal::TaskTracker::RunTaskImpl()
#22 0x7fea87b48e41 base::internal::TaskTracker::RunSkipOnShutdown()
#23 0x7fea87b48532 base::internal::TaskTracker::RunTask()
#24 0x7fea87b977c7 base::internal::TaskTrackerPosix::RunTask()
#25 0x7fea87b47f2f base::internal::TaskTracker::RunAndPopNextTask()
#26 0x7fea87b53dd9 base::internal::WorkerThread::RunWorker()
#27 0x7fea87b53a2d base::internal::WorkerThread::RunSharedWorker()
#28 0x7fea87b982ac base::(anonymous namespace)::ThreadFunc()
#29 0x7fea760ab259 start_thread
#30 0x7fea758785e3 __GI___clone
  r8: 0000000000000011  r9: 8080808080808080 r10: 00007fea8793a720 r11: 00007fea87a7b960
 r12: 00007fea36019dc0 r13: 00007fea1c004010 r14: 00007fea36019db8 r15: 00007fea36019d20
  di: 0000000000000000  si: 000055a7c30bea71  bp: 00007fea36019d10  bx: 00007fea1c004010
  dx: 0000000000000001  ax: 0000000000000001  cx: 0000000000000002  sp: 00007fea36019cd0
  ip: 00007fea7df423ef efl: 0000000000010246 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000006 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]

  1. Fail to create native pixmaps for video frames

Error:

[57100:57100:1129/193649.997897:ERROR:gpu_memory_buffer_support_x11.cc(133)] Can't create buffer -- unsupported config: usage=SCANOUT_VDA_WRITE, format=RGBX_8888

Solution/Workaround:

 media/mojo/services/gpu_mojo_media_client_cros.cc | 2 +-
 ui/gfx/linux/gpu_memory_buffer_support_x11.cc     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/media/mojo/services/gpu_mojo_media_client_cros.cc b/media/mojo/services/gpu_mojo_media_client_cros.cc
index b767da396d21..eeaafb110bed 100644
--- a/media/mojo/services/gpu_mojo_media_client_cros.cc
+++ b/media/mojo/services/gpu_mojo_media_client_cros.cc
@@ -23,7 +23,7 @@ bool ShouldUseChromeOSDirectVideoDecoder(
     const gpu::GPUInfo& gpu_info) {
 #if defined(OS_CHROMEOS)
   return gpu_preferences.enable_chromeos_direct_video_decoder;
-#elif BUILDFLAG(ENABLE_VULKAN)
+#elif 0
   if (!base::FeatureList::IsEnabled(kVaapiVideoDecodeLinux))
     return false;
   for (const auto& device : gpu_info.vulkan_info->physical_devices) {
diff --git a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc b/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
index ced865082c26..e7e182a476e9 100644
--- a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
+++ b/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
@@ -74,6 +74,7 @@ std::vector<gfx::BufferUsageAndFormat> CreateSupportedConfigList(
            gfx::BufferUsage::SCANOUT,
            gfx::BufferUsage::SCANOUT_CPU_READ_WRITE,
            gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
+           gfx::BufferUsage::SCANOUT_VDA_WRITE,
        }) {
     for (gfx::BufferFormat format : {
              gfx::BufferFormat::R_8,

Ozone/Wayland

TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment