chromium-browser-stable-sla.../vdpau-support.patch
Mikhail Novosyolov 6aceefa0d9 upd: 88.0.4324.182 -> 89.0.4389.82
- first build of v89
- replaced custom BUILD.gn with a patch of source code; we may just miss that custom BUILD.gn has stopped working, but we will explicitly detect the moment when applying patch fails (custom BUILD.gn may be restored later if it makes sense to reduce maintenance burden)
- dropped build-with-pipewire-0.3.patch, upstream now supports both pipewire 0.2 and 0.3
- took updated chromium-40-sorenson-spark.patch and chromium-55-extra-media.patch from Mageia (I want to remove these patches actually)
- dropped some patches with not needed compiler-related changes
- spec clean up:
  + removed not used for a long time support of building with GCC (Chromium upstream has tight integration with clang, I don't think that we will ever need buildability with GCC, for now it may be broken and just makes the spec more complex)
  + removed switches of libpng and vaapi without changing their values to redcue complexity of the spec
- removed not used VA-API patch, replaced with VA-API enhacements from ppa:saiarcot895/chromium-beta, including support of VA-API VDPAU backend on Nvidia proprietary drivers
2021-03-07 20:40:51 +03:00

152 lines
6.5 KiB
Diff

Taken from https://aur.archlinux.org/cgit/aur.git/tree/vdpau-support.patch?h=chromium-vaapi
Index: dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
===================================================================
--- dev.orig/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+++ dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
@@ -711,7 +711,8 @@ void VaapiVideoDecodeAccelerator::Assign
// implementation we get from |vaapi_picture_factory_| requires the video
// processing pipeline for downloading the decoded frame from the internal
// surface, we need to create a |vpp_vaapi_wrapper_|.
- if (requires_vpp && buffer_allocation_mode_ != BufferAllocationMode::kNone) {
+ if (requires_vpp && buffer_allocation_mode_ != BufferAllocationMode::kNone &&
+ buffer_allocation_mode_ != BufferAllocationMode::kWrapVdpau) {
if (!vpp_vaapi_wrapper_) {
vpp_vaapi_wrapper_ = VaapiWrapper::Create(
VaapiWrapper::kVideoProcess, VAProfileNone,
@@ -1226,6 +1227,12 @@ VaapiVideoDecodeAccelerator::DecideBuffe
return BufferAllocationMode::kReduced;
return BufferAllocationMode::kSuperReduced;
#else
+ // 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)
@@ -1236,7 +1243,7 @@ VaapiVideoDecodeAccelerator::DecideBuffe
// associated format reconciliation copy, avoiding all internal buffer
// allocations.
// TODO(crbug.com/911754): Enable for VP9 Profile 2.
- if (IsGeminiLakeOrLater() &&
+ if (false && IsGeminiLakeOrLater() &&
(profile_ == VP9PROFILE_PROFILE0 || profile_ == VP8PROFILE_ANY ||
(profile_ >= H264PROFILE_MIN && profile_ <= H264PROFILE_MAX))) {
// Add one to the reference frames for the one being currently egressed, and
Index: dev/media/gpu/vaapi/vaapi_video_decode_accelerator.h
===================================================================
--- dev.orig/media/gpu/vaapi/vaapi_video_decode_accelerator.h
+++ dev/media/gpu/vaapi/vaapi_video_decode_accelerator.h
@@ -217,6 +217,7 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeA
// Using |client_|s provided PictureBuffers and as many internally
// allocated.
kNormal,
+ kWrapVdpau,
};
// Decides the concrete buffer allocation mode, depending on the hardware
Index: dev/media/gpu/vaapi/vaapi_wrapper.cc
===================================================================
--- dev.orig/media/gpu/vaapi/vaapi_wrapper.cc
+++ dev/media/gpu/vaapi/vaapi_wrapper.cc
@@ -240,6 +240,9 @@ media::VAImplementation VendorStringToIm
} 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;
}
@@ -1977,6 +1980,11 @@ VaapiWrapper::ExportVASurfaceAsNativePix
return nullptr;
}
+ if (GetImplementationType() == VAImplementation::kNVIDIAVDPAU) {
+ LOG(ERROR) << "Disabled due to potential breakage.";
+ return nullptr;
+ }
+
VADRMPRIMESurfaceDescriptor descriptor;
{
base::AutoLock auto_lock(*va_lock_);
@@ -2680,32 +2688,43 @@ bool VaapiWrapper::CreateSurfaces(unsign
DCHECK(va_surfaces->empty());
va_surfaces->resize(num_surfaces);
+
VASurfaceAttrib attribute{};
- attribute.type = VASurfaceAttribUsageHint;
- attribute.flags = VA_SURFACE_ATTRIB_SETTABLE;
- attribute.value.type = VAGenericValueTypeInteger;
- switch (usage_hint) {
- case SurfaceUsageHint::kVideoDecoder:
- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER;
- break;
- case SurfaceUsageHint::kVideoEncoder:
- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
- break;
- case SurfaceUsageHint::kVideoProcessWrite:
- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
- break;
- case SurfaceUsageHint::kGeneric:
- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC;
- break;
+ if (GetImplementationType() != VAImplementation::kNVIDIAVDPAU) {
+ // Nvidia's VAAPI-VDPAU driver doesn't support this attribute
+ attribute.type = VASurfaceAttribUsageHint;
+ attribute.flags = VA_SURFACE_ATTRIB_SETTABLE;
+ attribute.value.type = VAGenericValueTypeInteger;
+ switch (usage_hint) {
+ case SurfaceUsageHint::kVideoDecoder:
+ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER;
+ break;
+ case SurfaceUsageHint::kVideoEncoder:
+ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
+ break;
+ case SurfaceUsageHint::kVideoProcessWrite:
+ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
+ break;
+ case SurfaceUsageHint::kGeneric:
+ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC;
+ break;
+ }
}
VAStatus va_res;
{
base::AutoLock auto_lock(*va_lock_);
- va_res = vaCreateSurfaces(
- va_display_, va_format, base::checked_cast<unsigned int>(size.width()),
- base::checked_cast<unsigned int>(size.height()), va_surfaces->data(),
- num_surfaces, &attribute, 1u);
+ if (GetImplementationType() == VAImplementation::kNVIDIAVDPAU) {
+ va_res = vaCreateSurfaces(
+ va_display_, va_format, base::checked_cast<unsigned int>(size.width()),
+ base::checked_cast<unsigned int>(size.height()), va_surfaces->data(),
+ num_surfaces, NULL, 0);
+ } else {
+ va_res = vaCreateSurfaces(
+ va_display_, va_format, base::checked_cast<unsigned int>(size.width()),
+ base::checked_cast<unsigned int>(size.height()), va_surfaces->data(),
+ num_surfaces, &attribute, 1u);
+ }
}
VA_LOG_ON_ERROR(va_res, VaapiFunctions::kVACreateSurfaces_Allocating);
return va_res == VA_STATUS_SUCCESS;
Index: dev/media/gpu/vaapi/vaapi_wrapper.h
===================================================================
--- dev.orig/media/gpu/vaapi/vaapi_wrapper.h
+++ dev/media/gpu/vaapi/vaapi_wrapper.h
@@ -92,6 +92,7 @@ enum class VAImplementation {
kIntelIHD,
kOther,
kInvalid,
+ kNVIDIAVDPAU,
};
// This class handles VA-API calls and ensures proper locking of VA-API calls