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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
From 9eef10b939b9eee6e7bb58c4ca3a8e119df518c1 Mon Sep 17 00:00:00 2001
From: Akarshan Biswas <akarshan.biswas@gmail.com>
Date: Sun, 4 Nov 2018 20:26:54 +0530
Subject: [PATCH] Enable vaapi on Linux
---
chrome/browser/about_flags.cc | 14 +++++++------
chrome/browser/flag_descriptions.cc | 22 +++++++++++++-------
chrome/browser/flag_descriptions.h | 16 +++++++++-----
components/viz/service/main/viz_main_impl.cc | 2 +-
content/gpu/BUILD.gn | 6 ++++++
content/gpu/gpu_main.cc | 4 ++--
gpu/config/software_rendering_list.json | 11 ----------
media/base/media_switches.cc | 2 +-
media/filters/BUILD.gn | 3 ++-
media/gpu/BUILD.gn | 7 +++++++
10 files changed, 52 insertions(+), 35 deletions(-)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index d029d0648..39df8d6cf 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1775,7 +1775,7 @@ const FeatureEntry kFeatureEntries[] = {
"disable-accelerated-video-decode",
flag_descriptions::kAcceleratedVideoDecodeName,
flag_descriptions::kAcceleratedVideoDecodeDescription,
- kOsMac | kOsWin | kOsCrOS | kOsAndroid,
+ kOsMac | kOsWin | kOsCrOS | kOsAndroid | kOsLinux,
SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
},
#if defined(OS_WIN)
@@ -2457,12 +2457,12 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kOpenVR)},
#endif // ENABLE_OPENVR
#endif // ENABLE_VR
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
{"disable-accelerated-mjpeg-decode",
flag_descriptions::kAcceleratedMjpegDecodeName,
- flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS,
+ flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS | kOsLinux,
SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)},
-#endif // OS_CHROMEOS
+#endif // OS_CHROMEOS OS_LINUX
{"v8-cache-options", flag_descriptions::kV8CacheOptionsName,
flag_descriptions::kV8CacheOptionsDescription, kOsAll,
MULTI_VALUE_TYPE(kV8CacheOptionsChoices)},
@@ -4444,12 +4444,14 @@ const FeatureEntry kFeatureEntries[] = {
"AutofillDropdownLayout")},
#endif // OS_ANDROID
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
{"enable-vaapi-jpeg-image-decode-acceleration",
flag_descriptions::kVaapiJpegImageDecodeAccelerationName,
- flag_descriptions::kVaapiJpegImageDecodeAccelerationDescription, kOsCrOS,
+ flag_descriptions::kVaapiJpegImageDecodeAccelerationDescription, kOsCrOS | kOsLinux,
FEATURE_VALUE_TYPE(features::kVaapiJpegImageDecodeAcceleration)},
+#endif
+#if defined(OS_CHROMEOS)
{"enable-home-launcher-gestures",
flag_descriptions::kEnableHomeLauncherGesturesName,
flag_descriptions::kEnableHomeLauncherGesturesDescription, kOsCrOS,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 0cb812619..df8ecb24e 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -3053,9 +3053,9 @@ const char kTextSuggestionsTouchBarDescription[] =
#endif
-// Chrome OS -------------------------------------------------------------------
+// Chrome OS and Linux -------------------------------------------------------------------
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
const char kAcceleratedMjpegDecodeName[] =
"Hardware-accelerated mjpeg decode for captured frame";
@@ -3063,6 +3063,18 @@ const char kAcceleratedMjpegDecodeDescription[] =
"Enable hardware-accelerated mjpeg decode for captured frame where "
"available.";
+const char kVaapiJpegImageDecodeAccelerationName[] =
+ "VA-API JPEG decode acceleration for images";
+const char kVaapiJpegImageDecodeAccelerationDescription[] =
+ "Enable or disable decode acceleration of JPEG images (as opposed to camera"
+ " captures) using the VA-API.";
+
+#endif // defined(OS_CHROMEOS) defined(OS_LINUX) and !defined(OS_ANDROID)
+
+// Only Chrome OS ------------------------------------------------------
+
+#if defined(OS_CHROMEOS)
+
const char kAllowTouchpadThreeFingerClickName[] = "Touchpad three-finger-click";
const char kAllowTouchpadThreeFingerClickDescription[] =
"Enables touchpad three-finger-click as middle button.";
@@ -3564,12 +3576,6 @@ const char kUseMonitorColorSpaceDescription[] =
"Enables Chrome to use the color space information provided by the monitor"
" instead of the default sRGB color space.";
-const char kVaapiJpegImageDecodeAccelerationName[] =
- "VA-API JPEG decode acceleration for images";
-const char kVaapiJpegImageDecodeAccelerationDescription[] =
- "Enable or disable decode acceleration of JPEG images (as opposed to camera"
- " captures) using the VA-API.";
-
const char kVideoPlayerChromecastSupportName[] =
"Experimental Chromecast support for Video Player";
const char kVideoPlayerChromecastSupportDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index b3c5e5691..14d7e33e9 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1846,13 +1846,22 @@ extern const char kPermissionPromptPersistenceToggleDescription[];
#endif // defined(OS_MACOSX)
-// Chrome OS ------------------------------------------------------------------
+// Chrome OS and Linux ------------------------------------------------------------------
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
extern const char kAcceleratedMjpegDecodeName[];
extern const char kAcceleratedMjpegDecodeDescription[];
+extern const char kVaapiJpegImageDecodeAccelerationName[];
+extern const char kVaapiJpegImageDecodeAccelerationDescription[];
+
+#endif
+
+// Chrome OS ----------------------------------------------------------------------
+
+#if defined(OS_CHROMEOS)
+
extern const char kAllowTouchpadThreeFingerClickName[];
extern const char kAllowTouchpadThreeFingerClickDescription[];
@@ -2158,9 +2167,6 @@ extern const char kUseMashDescription[];
extern const char kUseMonitorColorSpaceName[];
extern const char kUseMonitorColorSpaceDescription[];
-extern const char kVaapiJpegImageDecodeAccelerationName[];
-extern const char kVaapiJpegImageDecodeAccelerationDescription[];
-
extern const char kVideoPlayerChromecastSupportName[];
extern const char kVideoPlayerChromecastSupportDescription[];
diff --git a/components/viz/service/main/viz_main_impl.cc b/components/viz/service/main/viz_main_impl.cc
index 2196abef4..b4e0a1ae1 100644
--- a/components/viz/service/main/viz_main_impl.cc
+++ b/components/viz/service/main/viz_main_impl.cc
@@ -41,7 +41,7 @@ std::unique_ptr<base::Thread> CreateAndStartIOThread() {
// It should be possible to use |main_task_runner_| for doing IO tasks.
base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
thread_options.priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(reveman): Remove this in favor of setting it explicitly for each
// type of process.
thread_options.priority = base::ThreadPriority::DISPLAY;
diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn
index 8974e441d..d7eba85a9 100644
--- a/content/gpu/BUILD.gn
+++ b/content/gpu/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/jumbo.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//media/media_options.gni")
+import("//media/gpu/args.gni")
import("//ui/ozone/ozone.gni")
# See //content/BUILD.gn for how this works.
@@ -134,4 +135,9 @@ target(link_target_type, "gpu_sources") {
(!is_chromecast || is_cast_desktop_build)) {
configs += [ "//build/config/linux/dri" ]
}
+
+ # Use vaapi on desktop Linux builds when use_vaapi is set
+ if (is_desktop_linux && use_vaapi) {
+ public_configs = [ "//media/gpu:libva_config" ]
+ }
}
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index f589d015d..03fd1b44a 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -283,7 +283,7 @@ int GpuMain(const MainFunctionParams& parameters) {
base::PlatformThread::SetName("CrGpuMain");
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_LINUX)
// Set thread priority before sandbox initialization.
base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
#endif
@@ -316,7 +316,7 @@ int GpuMain(const MainFunctionParams& parameters) {
GetContentClient()->SetGpuInfo(gpu_init->gpu_info());
base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_LINUX)
io_thread_priority = base::ThreadPriority::DISPLAY;
#endif
diff --git a/gpu/config/software_rendering_list.json b/gpu/config/software_rendering_list.json
index 445953a64..0aac9ddb6 100644
--- a/gpu/config/software_rendering_list.json
+++ b/gpu/config/software_rendering_list.json
@@ -373,17 +373,6 @@
"all"
]
},
- {
- "id": 48,
- "description": "Accelerated video decode is unavailable on Linux",
- "cr_bugs": [137247],
- "os": {
- "type": "linux"
- },
- "features": [
- "accelerated_video_decode"
- ]
- },
{
"id": 50,
"description": "Disable VMware software renderer on older Mesa",
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
index 684c1d5cf..e887e60bb 100644
--- a/media/base/media_switches.cc
+++ b/media/base/media_switches.cc
@@ -468,7 +468,7 @@ bool IsVideoCaptureAcceleratedJpegDecodingEnabled() {
switches::kUseFakeJpegDecodeAccelerator)) {
return true;
}
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
return true;
#endif
return false;
diff --git a/media/filters/BUILD.gn b/media/filters/BUILD.gn
index ab6215152..b8d1ee896 100644
--- a/media/filters/BUILD.gn
+++ b/media/filters/BUILD.gn
@@ -5,6 +5,7 @@
import("//build/config/jumbo.gni")
import("//media/media_options.gni")
import("//third_party/libaom/options.gni")
+import("//media/gpu/args.gni")
jumbo_source_set("filters") {
# Do not expand the visibility here without double-checking with OWNERS, this
@@ -198,7 +199,7 @@ jumbo_source_set("filters") {
deps += [ "//media/base/android" ]
}
- if (current_cpu != "arm" && is_linux) {
+ if (use_vaapi && is_linux) {
sources += [
"h264_bitstream_buffer.cc",
"h264_bitstream_buffer.h",
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn
index 9ef4730a4..0c3a06c24 100644
--- a/media/gpu/BUILD.gn
+++ b/media/gpu/BUILD.gn
@@ -501,6 +501,12 @@ if (use_v4l2_codec || use_vaapi || is_mac || is_win) {
}
}
+import("//build/config/linux/pkg_config.gni")
+
+pkg_config("libva_config") {
+ packages = [ "libva" ]
+}
+
if (use_vaapi) {
test("jpeg_encode_accelerator_unittest") {
deps = [
@@ -571,6 +577,7 @@ if (use_v4l2_codec || use_vaapi) {
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
+ public_configs = [ ":libva_config" ]
}
}
--
2.19.1
|