From 882f184c471fc8e5c59ead4e4c8eaf06dc7f89da Mon Sep 17 00:00:00 2001 From: Jianhui Dai Date: Wed, 4 Sep 2024 01:28:15 +0000 Subject: [PATCH] vaapi_decoder/linux: P010 Zero-Copy for VA-API Video Decoding for Vulkan This CL adds P010 to the list of renderable formats for Vulkan, enabling zero-copy video decoding via VA-API. By avoiding the unnecessary conversion from P010 to NV12, this optimization preserves color depth and improves overall performance. Test on Ubuntu 22.04 for Alder Lake: Linux Ozone-Wayland Vulkan: ` chrome --ignore-gpu-blocklist --disable-gpu-driver-bug-workaround --enable-features=Vulkan,VaapiIgnoreDriverChecks,DefaultANGLEVulkan,VulkanFromANGLE --use-gl=angle --use-angle=vulkan --ozone-platform=wayland ` Linux Ozone-X11 Vulkan: ` chrome --ignore-gpu-blocklist --disable-gpu-driver-bug-workaround --enable-features=Vulkan,VaapiIgnoreDriverChecks,DefaultANGLEVulkan,VulkanFromANGLE --use-gl=angle --use-angle=vulkan --ozone-platform=x11 ` HEVC Main 10 10-bit test video: https://developer.apple.com/videos/play/wwdc2024/10136/ Bug: 349428388 Change-Id: I4a5524d8224982e44a928467bb37a46b8404d402 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5831505 Reviewed-by: Ted (Chromium) Meyer Reviewed-by: Andres Calderon Jaramillo Commit-Queue: Jianhui J Dai Cr-Commit-Position: refs/heads/main@{#1350537} --- .../mojo/services/gpu_mojo_media_client_linux.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/media/mojo/services/gpu_mojo_media_client_linux.cc b/media/mojo/services/gpu_mojo_media_client_linux.cc index 6c8dcffca050..c592c2e4c2c2 100644 --- a/media/mojo/services/gpu_mojo_media_client_linux.cc +++ b/media/mojo/services/gpu_mojo_media_client_linux.cc @@ -45,20 +45,21 @@ VideoDecoderType GetPreferredLinuxDecoderImplementation() { std::vector GetPreferredRenderableFourccs( const gpu::GpuPreferences& gpu_preferences) { std::vector renderable_fourccs; - // TODO(crbug.com/349428388): For HEVC Main 10 and VP9 Profile2 10-bit video, - // the current implementation requires additional VPP to convert the P010 - // format to a renderable format. This VPP happens on the Vulkan path - // (P010 -> NV12) and OpenGL path (P010 -> AR24). While this VPP introduces a - // loss of color depth, it should be optimized for zero-copy path in the - // future. #if BUILDFLAG(ENABLE_VULKAN) - // Support for zero-copy NV12 textures preferentially. + // Support for zero-copy NV12/P010 textures preferentially. if (gpu_preferences.gr_context_type == gpu::GrContextType::kVulkan) { renderable_fourccs.emplace_back(Fourcc::NV12); + renderable_fourccs.emplace_back(Fourcc::P010); } #endif // BUILDFLAG(ENABLE_VULKAN) // Support 1-copy argb textures. + // + // TODO(crbug.com/349428388): For VP9 Profile2 and HEVC Main 10 10-bit video, + // the current implementation requires additional VPP to convert the NV12/P010 + // format to a renderable format AR24. While this VPP introduces a loss of + // color depth (P010 -> AR24), it should be optimized for zero-copy path in + // the future. renderable_fourccs.emplace_back(Fourcc::AR24); return renderable_fourccs;