1
Description: Enables using VA-API hardware acceleration in Linux. The patch for bpf_gpu_policy_linux.cc initially came from https://codereview.chromium.org/15955009/diff/92001/content/common/sandbox_linux/bpf_gpu_policy_linux.cc.
3
Index: dev.xenial/chrome/browser/about_flags.cc
4
===================================================================
5
--- dev.xenial.orig/chrome/browser/about_flags.cc
6
+++ dev.xenial/chrome/browser/about_flags.cc
7
@@ -869,7 +869,7 @@ const FeatureEntry kFeatureEntries[] = {
8
"disable-accelerated-video-decode",
9
IDS_FLAGS_ACCELERATED_VIDEO_DECODE_NAME,
10
IDS_FLAGS_ACCELERATED_VIDEO_DECODE_DESCRIPTION,
11
- kOsMac | kOsWin | kOsCrOS,
13
SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
16
Index: dev.xenial/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
17
===================================================================
18
--- dev.xenial.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
19
+++ dev.xenial/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
21
#include "base/macros.h"
22
#include "base/memory/ptr_util.h"
23
#include "build/build_config.h"
24
+// Auto-generated for dlopen libva libraries
25
+#include "content/common/va_stubs.h"
26
#include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
27
#include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
28
#include "content/common/set_process_title.h"
30
#include "sandbox/linux/syscall_broker/broker_file_permission.h"
31
#include "sandbox/linux/syscall_broker/broker_process.h"
32
#include "sandbox/linux/system_headers/linux_syscalls.h"
33
+#include "third_party/libva/va/va.h"
34
+#include "third_party/libva/va/va_x11.h"
36
using sandbox::arch_seccomp_data;
37
using sandbox::bpf_dsl::Allow;
38
@@ -42,6 +46,14 @@ using sandbox::syscall_broker::BrokerFil
39
using sandbox::syscall_broker::BrokerProcess;
40
using sandbox::SyscallSets;
42
+using content_common::kModuleVa;
43
+using content_common::kModuleVa_x11;
44
+#if defined(USE_OZONE)
45
+using content_common::kModuleVa_drm;
47
+using content_common::InitializeStubs;
48
+using content_common::StubPathMap;
53
@@ -96,7 +108,7 @@ inline bool UseLibV4L2() {
55
bool IsAcceleratedVaapiVideoEncodeEnabled() {
56
bool accelerated_encode_enabled = false;
57
-#if defined(OS_CHROMEOS)
58
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
59
const base::CommandLine& command_line =
60
*base::CommandLine::ForCurrentProcess();
61
accelerated_encode_enabled =
62
@@ -302,27 +314,65 @@ bool GpuProcessPolicy::PreSandboxHook()
63
// inside the sandbox, so preload them now.
64
if (IsAcceleratedVaapiVideoEncodeEnabled() ||
65
IsAcceleratedVideoDecodeEnabled()) {
66
- const char* I965DrvVideoPath = NULL;
67
- const char* I965HybridDrvVideoPath = NULL;
69
- if (IsArchitectureX86_64()) {
70
- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
71
- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
72
- } else if (IsArchitectureI386()) {
73
- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
74
+ VLOG(1) << "Attempting to enable hardware video acceleration.";
76
+ paths[kModuleVa].push_back("libva.so.1");
77
+ paths[kModuleVa_x11].push_back("libva-x11.so.1");
78
+#if defined(USE_OZONE)
79
+ paths[kModuleVa_drm].push_back("libva-drm.so.1");
81
+ if (!InitializeStubs(paths)) {
82
+ LOG(WARNING) << "Failed to initialize stubs";
86
- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
87
- if (I965HybridDrvVideoPath)
88
- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
89
- dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
90
+ // libva drivers won't get loaded even above two libraries get dlopened.
91
+ // Thus, libva calls will fail after post sandbox stage.
93
+ // To get the va driver loaded before sandboxing, upstream simply dlopen
94
+ // the hard-coded va driver path because ChromeOS is the only platform
95
+ // that Google want to support libva.
97
+ // While generic linux distros ship va driver as anywhere they want.
98
+ // Fortunately, the va driver will be loadded when vaInitialize() get
100
+ // So the following code is to call vaInitialize() before sandboxing.
102
+ VADisplay va_display = NULL;
103
#if defined(USE_OZONE)
104
- dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
105
-#elif defined(USE_X11)
106
- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
107
+ struct wl_display* wayland_display = wl_display_connect(NULL);
108
+ if (wayland_display) {
109
+ va_display = vaGetDisplayWl(wayland_display);
110
+ if (!vaDisplayIsValid(va_display)) {
111
+ LOG(WARNING) << "Failed to call vaGetDisplayWl()";
115
+ LOG(WARNING) << "Failed to find Wayland display";
122
+ Display* x_display = XOpenDisplay(NULL);
124
+ LOG(WARNING) << "Failed to find X-Display";
127
+ va_display = vaGetDisplay(x_display);
128
+ if (!vaDisplayIsValid(va_display)) {
129
+ LOG(WARNING) << "Failed to call vaGetDisplay()";
134
+ int major_version, minor_version;
135
+ if (vaInitialize(va_display, &major_version, &minor_version)
136
+ != VA_STATUS_SUCCESS) {
137
+ LOG(WARNING) << "Failed to call vaInitialize()";
140
+ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled()
141
+ } // end of IsArchitectureX86_64() || IsArchitectureI386()
145
Index: dev.xenial/content/content_gpu.gypi
146
===================================================================
147
--- dev.xenial.orig/content/content_gpu.gypi
148
+++ dev.xenial/content/content_gpu.gypi
153
- ['target_arch!="arm" and chromeos == 1', {
154
+ ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', {
156
'<(DEPTH)/third_party/libva',
158
Index: dev.xenial/content/gpu/BUILD.gn
159
===================================================================
160
--- dev.xenial.orig/content/gpu/BUILD.gn
161
+++ dev.xenial/content/gpu/BUILD.gn
162
@@ -85,7 +85,7 @@ source_set("gpu_sources") {
166
- if (is_chromeos && current_cpu != "arm") {
167
+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") {
168
configs += [ "//third_party/libva:libva_config" ]
171
Index: dev.xenial/content/gpu/gpu_main.cc
172
===================================================================
173
--- dev.xenial.orig/content/gpu/gpu_main.cc
174
+++ dev.xenial/content/gpu/gpu_main.cc
176
#include "content/common/sandbox_mac.h"
179
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
180
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)
181
#include "media/gpu/vaapi_wrapper.h"
184
@@ -252,7 +252,7 @@ int GpuMain(const MainFunctionParams& pa
185
GetGpuInfoFromCommandLine(gpu_info, command_line);
186
gpu_info.in_process_gpu = false;
188
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
189
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)
190
media::VaapiWrapper::PreSandboxInitialization();
193
Index: dev.xenial/content/public/common/content_switches.cc
194
===================================================================
195
--- dev.xenial.orig/content/public/common/content_switches.cc
196
+++ dev.xenial/content/public/common/content_switches.cc
197
@@ -970,7 +970,9 @@ const char kDisableAudioSupportForDeskto
198
#if defined(OS_CHROMEOS)
199
// Disables panel fitting (used for mirror mode).
200
const char kDisablePanelFitting[] = "disable-panel-fitting";
203
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
204
// Disables VA-API accelerated video encode.
205
const char kDisableVaapiAcceleratedVideoEncode[] =
206
"disable-vaapi-accelerated-video-encode";
207
Index: dev.xenial/content/public/common/content_switches.h
208
===================================================================
209
--- dev.xenial.orig/content/public/common/content_switches.h
210
+++ dev.xenial/content/public/common/content_switches.h
211
@@ -278,6 +278,8 @@ CONTENT_EXPORT extern const char kEnable
213
#if defined(OS_CHROMEOS)
214
CONTENT_EXPORT extern const char kDisablePanelFitting[];
216
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
217
CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[];
220
Index: dev.xenial/gpu/config/software_rendering_list_json.cc
221
===================================================================
222
--- dev.xenial.orig/gpu/config/software_rendering_list_json.cc
223
+++ dev.xenial/gpu/config/software_rendering_list_json.cc
224
@@ -488,17 +488,6 @@ const char kSoftwareRenderingListJson[]
229
- "description": "Accelerated video decode is unavailable on Linux",
230
- "cr_bugs": [137247],
235
- "accelerated_video_decode"
240
"description": "NVidia GeForce GT 650M can cause the system to hang with flash 3D",
242
Index: dev.xenial/media/BUILD.gn
243
===================================================================
244
--- dev.xenial.orig/media/BUILD.gn
245
+++ dev.xenial/media/BUILD.gn
246
@@ -339,7 +339,7 @@ component("media") {
247
allow_circular_includes_from = [ "//media/base/android" ]
250
- if (current_cpu != "arm" && is_chromeos) {
251
+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) {
253
"filters/h264_bitstream_buffer.cc",
254
"filters/h264_bitstream_buffer.h",
255
@@ -629,7 +629,7 @@ test("media_unittests") {
259
- if (current_cpu != "arm" && is_chromeos) {
260
+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) {
261
sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
264
Index: dev.xenial/media/gpu/BUILD.gn
265
===================================================================
266
--- dev.xenial.orig/media/gpu/BUILD.gn
267
+++ dev.xenial/media/gpu/BUILD.gn
268
@@ -12,7 +12,7 @@ if (is_mac) {
269
import("//build/config/mac/mac_sdk.gni")
272
-if (is_chromeos && current_cpu != "arm") {
273
+if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") {
274
action("libva_generate_stubs") {
275
extra_header = "va_stub_header.fragment"
277
@@ -229,7 +229,7 @@ component("gpu") {
284
"accelerated_video_decoder.h",
286
@@ -273,7 +273,7 @@ component("gpu") {
290
- if (current_cpu == "arm") {
291
+ if (current_cpu == "arm" && is_chromeos) {
293
"tegra_v4l2_device.cc",
294
"tegra_v4l2_device.h",
295
Index: dev.xenial/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
296
===================================================================
297
--- dev.xenial.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
298
+++ dev.xenial/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
300
#include "media/gpu/dxva_video_decode_accelerator_win.h"
301
#elif defined(OS_MACOSX)
302
#include "media/gpu/vt_video_decode_accelerator_mac.h"
303
-#elif defined(OS_CHROMEOS)
304
+#elif defined(OS_CHROMEOS) || defined(OS_LINUX)
305
#if defined(USE_V4L2_CODEC)
306
#include "media/gpu/v4l2_device.h"
307
#include "media/gpu/v4l2_slice_video_decode_accelerator.h"
308
@@ -79,7 +79,7 @@ GpuVideoDecodeAcceleratorFactoryImpl::Ge
310
capabilities.supported_profiles =
311
DXVAVideoDecodeAccelerator::GetSupportedProfiles();
312
-#elif defined(OS_CHROMEOS)
313
+#elif defined(OS_CHROMEOS) || defined(OS_LINUX)
314
media::VideoDecodeAccelerator::SupportedProfiles vda_profiles;
315
#if defined(USE_V4L2_CODEC)
316
vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles();
317
@@ -130,7 +130,7 @@ GpuVideoDecodeAcceleratorFactoryImpl::Cr
318
&GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2VDA,
319
&GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2SVDA,
321
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
322
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)
323
&GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA,
325
#if defined(OS_MACOSX)
326
@@ -194,10 +194,11 @@ GpuVideoDecodeAcceleratorFactoryImpl::Cr
330
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
331
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)
332
std::unique_ptr<media::VideoDecodeAccelerator>
333
GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA(
334
const gpu::GpuPreferences& gpu_preferences) const {
335
+ VLOG(1) << "Creating new VAAPI video decode accelerator.";
336
std::unique_ptr<media::VideoDecodeAccelerator> decoder;
337
decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_,
339
Index: dev.xenial/media/gpu/gpu_video_decode_accelerator_factory_impl.h
340
===================================================================
341
--- dev.xenial.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.h
342
+++ dev.xenial/media/gpu/gpu_video_decode_accelerator_factory_impl.h
343
@@ -99,7 +99,7 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcc
344
std::unique_ptr<media::VideoDecodeAccelerator> CreateV4L2SVDA(
345
const gpu::GpuPreferences& gpu_preferences) const;
347
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
348
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)
349
std::unique_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(
350
const gpu::GpuPreferences& gpu_preferences) const;
352
Index: dev.xenial/media/gpu/ipc/service/BUILD.gn
353
===================================================================
354
--- dev.xenial.orig/media/gpu/ipc/service/BUILD.gn
355
+++ dev.xenial/media/gpu/ipc/service/BUILD.gn
356
@@ -37,7 +37,7 @@ source_set("service") {
357
"//third_party/mesa:mesa_headers",
360
- if (is_chromeos && current_cpu != "arm") {
361
+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") {
362
configs += [ "//third_party/libva:libva_config" ]
365
Index: dev.xenial/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
366
===================================================================
367
--- dev.xenial.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
368
+++ dev.xenial/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
369
@@ -58,7 +58,7 @@ static bool MakeDecoderContextCurrent(
373
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
374
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
375
static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub,
376
uint32_t client_texture_id,
377
uint32_t texture_target,
378
@@ -170,7 +170,7 @@ GpuVideoDecodeAccelerator::GpuVideoDecod
379
get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr());
380
make_context_current_cb_ =
381
base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
382
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
383
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
384
bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr());
386
get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr());
387
Index: dev.xenial/media/gpu/vaapi_video_decode_accelerator.cc
388
===================================================================
389
--- dev.xenial.orig/media/gpu/vaapi_video_decode_accelerator.cc
390
+++ dev.xenial/media/gpu/vaapi_video_decode_accelerator.cc
391
@@ -342,17 +342,17 @@ bool VaapiVideoDecodeAccelerator::Initia
393
base::AutoLock auto_lock(lock_);
394
DCHECK_EQ(state_, kUninitialized);
395
- DVLOG(2) << "Initializing VAVDA, profile: " << profile;
396
+ VLOG(1) << "Initializing VAVDA, profile: " << profile;
399
if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) {
400
- DVLOG(1) << "HW video decode acceleration not available without "
401
+ VLOG(1) << "HW video decode acceleration not available without "
405
#elif defined(USE_OZONE)
406
if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
407
- DVLOG(1) << "HW video decode acceleration not available without "
408
+ VLOG(1) << "HW video decode acceleration not available without "
412
@@ -362,7 +362,7 @@ bool VaapiVideoDecodeAccelerator::Initia
413
VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR));
415
if (!vaapi_wrapper_.get()) {
416
- DVLOG(1) << "Failed initializing VAAPI for profile " << profile;
417
+ VLOG(1) << "Failed initializing VAAPI for profile " << profile;
421
@@ -379,7 +379,7 @@ bool VaapiVideoDecodeAccelerator::Initia
422
vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get()));
423
decoder_.reset(new VP9Decoder(vp9_accelerator_.get()));
425
- DLOG(ERROR) << "Unsupported profile " << profile;
426
+ VLOG(1) << "Unsupported profile " << profile;
430
Index: dev.xenial/media/gpu/vaapi_wrapper.cc
431
===================================================================
432
--- dev.xenial.orig/media/gpu/vaapi_wrapper.cc
433
+++ dev.xenial/media/gpu/vaapi_wrapper.cc
434
@@ -189,7 +189,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper
435
VAProfile va_profile,
436
const base::Closure& report_error_to_uma_cb) {
437
if (!profile_infos_.Get().IsProfileSupported(mode, va_profile)) {
438
- DVLOG(1) << "Unsupported va_profile: " << va_profile;
439
+ VLOG(1) << "Unsupported va_profile: " << va_profile;
443
@@ -342,15 +342,17 @@ VaapiWrapper::GetSupportedProfileInfosFo
444
bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) {
445
static bool vaapi_functions_initialized = PostSandboxInitialization();
446
if (!vaapi_functions_initialized) {
447
- bool running_on_chromeos = false;
448
-#if defined(OS_CHROMEOS)
449
+ bool error_level_logging = false;
450
+#if defined(OS_LINUX)
451
+ error_level_logging = true;
452
+#elif defined(OS_CHROMEOS)
453
// When chrome runs on linux with chromeos=1, do not log error message
454
// without VAAPI libraries.
455
- running_on_chromeos = base::SysInfo::IsRunningOnChromeOS();
456
+ error_level_logging = base::SysInfo::IsRunningOnChromeOS();
458
static const char kErrorMsg[] = "Failed to initialize VAAPI libs";
459
- if (running_on_chromeos)
460
- LOG(ERROR) << kErrorMsg;
461
+ if (error_level_logging)
462
+ VLOG(1) << kErrorMsg;
464
DVLOG(1) << kErrorMsg;
466
@@ -416,7 +418,7 @@ bool VaapiWrapper::IsEntrypointSupported
468
if (std::find(supported_entrypoints.begin(), supported_entrypoints.end(),
469
entrypoint) == supported_entrypoints.end()) {
470
- DVLOG(1) << "Unsupported entrypoint";
471
+ VLOG(1) << "Unsupported entrypoint";
475
@@ -440,8 +442,8 @@ bool VaapiWrapper::AreAttribsSupported_L
476
if (attribs[i].type != required_attribs[i].type ||
477
(attribs[i].value & required_attribs[i].value) !=
478
required_attribs[i].value) {
479
- DVLOG(1) << "Unsupported value " << required_attribs[i].value
480
- << " for attribute type " << required_attribs[i].type;
481
+ VLOG(1) << "Unsupported value " << required_attribs[i].value
482
+ << " for attribute type " << required_attribs[i].type;
486
Index: dev.xenial/media/media.gyp
487
===================================================================
488
--- dev.xenial.orig/media/media.gyp
489
+++ dev.xenial/media/media.gyp
493
# For VaapiVideoEncodeAccelerator.
494
- ['target_arch != "arm" and chromeos == 1', {
495
+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', {
497
'filters/h264_bitstream_buffer.cc',
498
'filters/h264_bitstream_buffer.h',
499
@@ -1330,7 +1330,7 @@
500
'cdm/cdm_adapter_unittest.cc',
503
- ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
504
+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', {
506
'filters/h264_bitstream_buffer_unittest.cc',
508
@@ -2264,7 +2264,7 @@
512
- ['chromeos==1 and target_arch != "arm"', {
513
+ ['(desktop_linux==1 or chromeos==1) and target_arch != "arm"', {
516
'target_name': 'vaapi_jpeg_decoder_unittest',
517
Index: dev.xenial/media/media_gpu.gypi
518
===================================================================
519
--- dev.xenial.orig/media/media_gpu.gypi
520
+++ dev.xenial/media/media_gpu.gypi
522
'gpu/tegra_v4l2_device.h',
525
- ['target_arch != "arm" and chromeos == 1', {
526
+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', {
528
'../media/media.gyp:media',
529
'../third_party/libyuv/libyuv.gyp:libyuv',
530
Index: dev.xenial/content/common/BUILD.gn
531
===================================================================
532
--- dev.xenial.orig/content/common/BUILD.gn
533
+++ dev.xenial/content/common/BUILD.gn
534
@@ -11,6 +11,49 @@ if (is_mac) {
535
import("//build/config/mac/mac_sdk.gni")
538
+if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") {
539
+ action("libva_generate_stubs") {
540
+ extra_header = "../../media/gpu/va_stub_header.fragment"
542
+ script = "../../tools/generate_stubs/generate_stubs.py"
544
+ "../../media/gpu/va.sigs",
549
+ sources += [ "../../media/gpu/va_x11.sigs" ]
552
+ "../../media/gpu/va_drm.sigs",
556
+ stubs_filename_root = "va_stubs"
559
+ "$target_gen_dir/$stubs_filename_root.cc",
560
+ "$target_gen_dir/$stubs_filename_root.h",
564
+ rebase_path("$target_gen_dir", root_build_dir),
566
+ rebase_path("$target_gen_dir", root_build_dir),
570
+ rebase_path(extra_header, root_build_dir),
572
+ stubs_filename_root,
577
+ args += rebase_path(sources, root_build_dir)
581
source_set("common") {
582
# Targets external to content should always link to the public API.
583
# In addition, targets outside of the content component (shell and tests)
584
@@ -178,6 +221,11 @@ source_set("common") {
586
if (use_seccomp_bpf) {
587
defines += [ "USE_SECCOMP_BPF" ]
588
+ if (current_cpu != "arm") {
589
+ sources += get_target_outputs(":libva_generate_stubs")
590
+ deps += [ ":libva_generate_stubs" ]
591
+ configs += [ "//third_party/libva:libva_config" ]