-
Notifications
You must be signed in to change notification settings - Fork 32
/
vdpau-support.patch
143 lines (139 loc) · 6.56 KB
/
vdpau-support.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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
@@ -708,7 +708,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,
@@ -1222,6 +1223,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)
@@ -1232,7 +1239,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
@@ -349,6 +349,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;
}
@@ -2608,6 +2611,12 @@ VaapiWrapper::ExportVASurfaceAsNativePix
sequence_checker_.CalledOnValidSequence());
DCHECK_NE(va_surface_id, VA_INVALID_SURFACE);
DCHECK(!va_surface_size.IsEmpty());
+
+ if (GetImplementationType() == VAImplementation::kNVIDIAVDPAU) {
+ LOG(ERROR) << "Disabled due to potential breakage.";
+ return nullptr;
+ }
+
VADRMPRIMESurfaceDescriptor descriptor;
{
base::AutoLockMaybe auto_lock(va_lock_.get());
@@ -3423,26 +3432,37 @@ bool VaapiWrapper::CreateSurfaces(
va_surfaces->resize(num_surfaces);
VASurfaceAttrib attribute;
- memset(&attribute, 0, sizeof(attribute));
- attribute.type = VASurfaceAttribUsageHint;
- attribute.flags = VA_SURFACE_ATTRIB_SETTABLE;
- attribute.value.type = VAGenericValueTypeInteger;
- attribute.value.value.i = 0;
- for (SurfaceUsageHint usage_hint : usage_hints)
- attribute.value.value.i |= static_cast<int32_t>(usage_hint);
- static_assert(std::is_same<decltype(attribute.value.value.i), int32_t>::value,
- "attribute.value.value.i is not int32_t");
- static_assert(std::is_same<std::underlying_type<SurfaceUsageHint>::type,
- int32_t>::value,
- "The underlying type of SurfaceUsageHint is not int32_t");
+
+ if (GetImplementationType() != VAImplementation::kNVIDIAVDPAU) {
+ // Nvidia's VAAPI-VDPAU driver doesn't support this attribute
+ memset(&attribute, 0, sizeof(attribute));
+ attribute.type = VASurfaceAttribUsageHint;
+ attribute.flags = VA_SURFACE_ATTRIB_SETTABLE;
+ attribute.value.type = VAGenericValueTypeInteger;
+ attribute.value.value.i = 0;
+ for (SurfaceUsageHint usage_hint : usage_hints)
+ attribute.value.value.i |= static_cast<int32_t>(usage_hint);
+ static_assert(std::is_same<decltype(attribute.value.value.i), int32_t>::value,
+ "attribute.value.value.i is not int32_t");
+ static_assert(std::is_same<std::underlying_type<SurfaceUsageHint>::type,
+ int32_t>::value,
+ "The underlying type of SurfaceUsageHint is not int32_t");
+ }
VAStatus va_res;
{
base::AutoLockMaybe auto_lock(va_lock_.get());
- 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
@@ -93,6 +93,7 @@ enum class VAImplementation {
kMesaGallium,
kIntelI965,
kIntelIHD,
+ kNVIDIAVDPAU,
kOther,
kInvalid,
};