Merge pull request #100101 from primeos/chromium

chromium: Disable VA-API by default
This commit is contained in:
Michael Weiss 2020-10-10 18:25:36 +02:00 committed by GitHub
commit cde2e109d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 121 deletions

@ -161,11 +161,10 @@ let
#
# ++ optionals (channel == "dev") [ ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" ) ]
# ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" )
]; # TODO: VA-API patches (we should be able to drop enable-video-acceleration-on-linux.patch now):
# ++ optionals (useVaapi && versionRange "68" "86") [ # Improvements for the VA-API build:
# ./patches/enable-vdpau-support-for-nvidia.patch # https://aur.archlinux.org/cgit/aur.git/tree/vdpau-support.patch?h=chromium-vaapi
# ./patches/enable-video-acceleration-on-linux.patch # Can be controlled at runtime (i.e. without rebuilding Chromium)
# ];
] ++ optionals (useVaapi) [
# Check for enable-accelerated-video-decode on Linux:
(githubPatch "54deb9811ca9bd2327def5c05ba6987b8c7a0897" "11jvxjlkzz1hm0pvfyr88j7z3zbwzplyl5idkx92l2lzv4459c8d")
];
postPatch = ''
# Required for patchShebangs (unsupported interpreter directive, basename: invalid option -- '*', etc.):

@ -15,7 +15,7 @@
, enablePepperFlash ? false
, enableWideVine ? false
, useVaapi ? false # Deprecated, use enableVaapi instead!
, enableVaapi ? false # Disabled by default due to unofficial support and issues on radeon
, enableVaapi ? false # Disabled by default due to unofficial support
, useOzone ? false
, cupsSupport ? true
, pulseSupport ? config.pulseaudio or stdenv.isLinux
@ -152,8 +152,8 @@ let
Chromium's useVaapi was replaced by enableVaapi and you don't need to pass
"--ignore-gpu-blacklist" anymore (also no rebuilds are required anymore).
'' else lib.optionalString
(!enableVaapi)
"--add-flags --disable-accelerated-video-decode --add-flags --disable-accelerated-video-encode";
(enableVaapi)
"--add-flags --enable-accelerated-video-decode";
in stdenv.mkDerivation {
name = "chromium${suffix}-${version}";
inherit version;

@ -1,65 +0,0 @@
--- a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
@@ -641,6 +641,7 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers(
// |vpp_vaapi_wrapper_| for VaapiPicture to DownloadFromSurface() the VA's
// internal decoded frame.
if (buffer_allocation_mode_ != BufferAllocationMode::kNone &&
+ buffer_allocation_mode_ != BufferAllocationMode::kWrapVdpau &&
!vpp_vaapi_wrapper_) {
vpp_vaapi_wrapper_ = VaapiWrapper::Create(
VaapiWrapper::kVideoProcess, VAProfileNone,
@@ -665,7 +666,8 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers(
PictureBuffer buffer = buffers[i];
buffer.set_size(requested_pic_size_);
std::unique_ptr<VaapiPicture> picture = vaapi_picture_factory_->Create(
- (buffer_allocation_mode_ == BufferAllocationMode::kNone)
+ ((buffer_allocation_mode_ == BufferAllocationMode::kNone) ||
+ (buffer_allocation_mode_ == BufferAllocationMode::kWrapVdpau))
? vaapi_wrapper_
: vpp_vaapi_wrapper_,
make_context_current_cb_, bind_image_cb_, buffer);
@@ -1093,6 +1095,12 @@ VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
VaapiVideoDecodeAccelerator::BufferAllocationMode
VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() {
+ // NVIDIA blobs use VDPAU
+ if (VaapiWrapper::GetImplementationType() == VAImplementation::kNVIDIAVDPAU) {
+ LOG(INFO) << "VA-API driver on VDPAU backend";
+ return BufferAllocationMode::kWrapVdpau;
+ }
+
// TODO(crbug.com/912295): Enable a better BufferAllocationMode for IMPORT
// |output_mode_| as well.
if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT)
--- a/media/gpu/vaapi/vaapi_video_decode_accelerator.h
+++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.h
@@ -204,6 +204,7 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
// Using |client_|s provided PictureBuffers and as many internally
// allocated.
kNormal,
+ kWrapVdpau,
};
// Decides the concrete buffer allocation mode, depending on the hardware
--- a/media/gpu/vaapi/vaapi_wrapper.cc
+++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -131,6 +131,9 @@ media::VAImplementation VendorStringToImplementationType(
} else if (base::StartsWith(va_vendor_string, "Intel iHD driver",
base::CompareCase::SENSITIVE)) {
return media::VAImplementation::kIntelIHD;
+ } else if (base::StartsWith(va_vendor_string, "Splitted-Desktop Systems VDPAU",
+ base::CompareCase::SENSITIVE)) {
+ return media::VAImplementation::kNVIDIAVDPAU;
}
return media::VAImplementation::kOther;
}
--- a/media/gpu/vaapi/vaapi_wrapper.h
+++ b/media/gpu/vaapi/vaapi_wrapper.h
@@ -79,6 +79,7 @@ enum class VAImplementation {
kIntelIHD,
kOther,
kInvalid,
+ kNVIDIAVDPAU,
};
// This class handles VA-API calls and ensures proper locking of VA-API calls

@ -1,48 +0,0 @@
From b2144fd28e09cd52e7a88a62a9d9b54cf9922f9f Mon Sep 17 00:00:00 2001
From: Michael Weiss <dev.primeos@gmail.com>
Date: Tue, 14 Apr 2020 14:16:10 +0200
Subject: [PATCH] Enable accelerated video decode on Linux
This will enable accelerated video decode on Linux by default (i.e.
without "--ignore-gpu-blacklist"), but on NixOS we'll provide
"--disable-accelerated-video-decode" and
"--disable-accelerated-video-encode" by default to avoid regressions
(e.g. VA-API doesn't work properly for some radeon drivers).
Video acceleration can then be enabled via:
chromium.override { enableVaapi = true; }
without rebuilding Chromium.
---
gpu/config/software_rendering_list.json | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/gpu/config/software_rendering_list.json b/gpu/config/software_rendering_list.json
index 22712bdbf38f..a06dd19a50e4 100644
--- a/gpu/config/software_rendering_list.json
+++ b/gpu/config/software_rendering_list.json
@@ -336,22 +336,6 @@
]
},
{
- "id": 48,
- "description": "Accelerated video decode is unavailable on Linux",
- "cr_bugs": [137247, 1032907],
- "os": {
- "type": "linux"
- },
- "exceptions": [
- {
- "machine_model_name": ["Chromecast"]
- }
- ],
- "features": [
- "accelerated_video_decode"
- ]
- },
- {
"id": 50,
"description": "Disable VMware software renderer on older Mesa",
"cr_bugs": [145531, 332596, 571899, 629434],
--
2.11.0