summaryrefslogtreecommitdiffstats
path: root/chromium-dev/build/patches/chromium_vaapi.patch
blob: 0547646fe0b379d5bac4daa7870833cff125043f (plain)
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
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

Taken from:
https://code.launchpad.net/~saiarcot895/chromium-browser/chromium-browser.wily.dev
And rebased against chromium-dev 48.0.2535.0 sources.

--------

diff -uarN chromium-48.0.2535.0.orig/chrome/browser/about_flags.cc chromium-48.0.2535.0/chrome/browser/about_flags.cc
--- chromium-48.0.2535.0.orig/chrome/browser/about_flags.cc	2015-10-14 09:01:19.000000000 +0200
+++ chromium-48.0.2535.0/chrome/browser/about_flags.cc	2015-10-18 13:19:06.991657439 +0200
@@ -1007,7 +1007,7 @@
      "disable-accelerated-video-decode",
      IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_NAME,
      IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_DESCRIPTION,
-     kOsMac | kOsWin | kOsCrOS,
+     kOsAll,
      SINGLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
     },
 #if defined(USE_ASH)
diff -uarN chromium-48.0.2535.0.orig/content/common/gpu/client/command_buffer_proxy_impl.cc chromium-48.0.2535.0/content/common/gpu/client/command_buffer_proxy_impl.cc
--- chromium-48.0.2535.0.orig/content/common/gpu/client/command_buffer_proxy_impl.cc	2015-10-14 09:01:20.000000000 +0200
+++ chromium-48.0.2535.0/content/common/gpu/client/command_buffer_proxy_impl.cc	2015-10-18 13:19:07.023662747 +0200
@@ -614,8 +614,10 @@
 
 scoped_ptr<media::VideoDecodeAccelerator>
 CommandBufferProxyImpl::CreateVideoDecoder() {
+  TRACE_EVENT0("gpu", "CommandBufferProxyImpl::CreateVideoDecoder");
   if (!channel_)
     return scoped_ptr<media::VideoDecodeAccelerator>();
+  VLOG(1) << "About to create GpuVideoDecodeAcceleratorHost.";
   return scoped_ptr<media::VideoDecodeAccelerator>(
       new GpuVideoDecodeAcceleratorHost(channel_, this));
 }
diff -uarN chromium-48.0.2535.0.orig/content/common/gpu/media/gpu_video_decode_accelerator.cc chromium-48.0.2535.0/content/common/gpu/media/gpu_video_decode_accelerator.cc
--- chromium-48.0.2535.0.orig/content/common/gpu/media/gpu_video_decode_accelerator.cc	2015-10-14 09:01:20.000000000 +0200
+++ chromium-48.0.2535.0/content/common/gpu/media/gpu_video_decode_accelerator.cc	2015-10-18 13:19:06.911644181 +0200
@@ -33,7 +33,7 @@
 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
 #elif defined(OS_MACOSX)
 #include "content/common/gpu/media/vt_video_decode_accelerator.h"
-#elif defined(OS_CHROMEOS)
+#elif defined(OS_CHROMEOS) || defined(OS_LINUX)
 #if defined(USE_V4L2_CODEC)
 #include "content/common/gpu/media/v4l2_device.h"
 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h"
@@ -252,6 +252,8 @@
   }
 #endif
 
+  VLOG(1) << "Initializing GPU video decode accelerator.";
+
   // Array of Create..VDA() function pointers, maybe applicable to the current
   // platform. This list is ordered by priority of use and it should be the
   // same as the order of querying supported profiles of VDAs.
@@ -265,11 +267,14 @@
       &GpuVideoDecodeAccelerator::CreateAndroidVDA};
 
   for (const auto& create_vda_function : create_vda_fps) {
+    VLOG(1) << "Testing create_vda_function.";
     video_decode_accelerator_ = (this->*create_vda_function)();
     if (!video_decode_accelerator_ ||
         !video_decode_accelerator_->Initialize(profile, this))
       continue;
 
+    VLOG(1) << "Initialization successful.";
+
     if (video_decode_accelerator_->CanDecodeOnIOThread()) {
       filter_ = new MessageFilter(this, host_route_id_);
       stub_->channel()->AddFilter(filter_.get());
@@ -347,7 +352,9 @@
 scoped_ptr<media::VideoDecodeAccelerator>
 GpuVideoDecodeAccelerator::CreateVaapiVDA() {
   scoped_ptr<media::VideoDecodeAccelerator> decoder;
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
+  VLOG(1) << "About to create new VAAPI video decode accelerator.";
+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
+  VLOG(1) << "Creating new VAAPI video decode accelerator.";
   decoder.reset(new VaapiVideoDecodeAccelerator(
       make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage,
                                         base::Unretained(this))));
@@ -401,7 +408,7 @@
   // can be initialized by corresponding VDA successfully.
 #if defined(OS_WIN)
   profiles = DXVAVideoDecodeAccelerator::GetSupportedProfiles();
-#elif defined(OS_CHROMEOS)
+#elif defined(OS_CHROMEOS) || defined(OS_LINUX)
   media::VideoDecodeAccelerator::SupportedProfiles vda_profiles;
 #if defined(USE_V4L2_CODEC)
   vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles();
diff -uarN chromium-48.0.2535.0.orig/content/common/gpu/media/vaapi_video_decode_accelerator.cc chromium-48.0.2535.0/content/common/gpu/media/vaapi_video_decode_accelerator.cc
--- chromium-48.0.2535.0.orig/content/common/gpu/media/vaapi_video_decode_accelerator.cc	2015-10-14 09:01:20.000000000 +0200
+++ chromium-48.0.2535.0/content/common/gpu/media/vaapi_video_decode_accelerator.cc	2015-10-18 13:19:07.006659929 +0200
@@ -324,17 +324,17 @@
 
   base::AutoLock auto_lock(lock_);
   DCHECK_EQ(state_, kUninitialized);
-  DVLOG(2) << "Initializing VAVDA, profile: " << profile;
+  VLOG(1) << "Initializing VAVDA, profile: " << profile;
 
 #if defined(USE_X11)
   if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) {
-    DVLOG(1) << "HW video decode acceleration not available without "
+    VLOG(1) << "HW video decode acceleration not available without "
                 "DesktopGL (GLX).";
     return false;
   }
 #elif defined(USE_OZONE)
   if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
-    DVLOG(1) << "HW video decode acceleration not available without "
+    VLOG(1) << "HW video decode acceleration not available without "
              << "EGLGLES2.";
     return false;
   }
@@ -344,7 +344,7 @@
       VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR));
 
   if (!vaapi_wrapper_.get()) {
-    DVLOG(1) << "Failed initializing VAAPI for profile " << profile;
+    VLOG(1) << "Failed initializing VAAPI for profile " << profile;
     return false;
   }
 
@@ -361,7 +361,7 @@
     vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get()));
     decoder_.reset(new VP9Decoder(vp9_accelerator_.get()));
   } else {
-    DLOG(ERROR) << "Unsupported profile " << profile;
+    VLOG(1) << "Unsupported profile " << profile;
     return false;
   }
 
diff -uarN chromium-48.0.2535.0.orig/content/common/gpu/media/vaapi_wrapper.cc chromium-48.0.2535.0/content/common/gpu/media/vaapi_wrapper.cc
--- chromium-48.0.2535.0.orig/content/common/gpu/media/vaapi_wrapper.cc	2015-10-14 09:01:20.000000000 +0200
+++ chromium-48.0.2535.0/content/common/gpu/media/vaapi_wrapper.cc	2015-10-18 13:19:07.004659596 +0200
@@ -147,7 +147,7 @@
     VAProfile va_profile,
     const base::Closure& report_error_to_uma_cb) {
   if (!profile_infos_.Get().IsProfileSupported(mode, va_profile)) {
-    DVLOG(1) << "Unsupported va_profile: " << va_profile;
+    VLOG(1) << "Unsupported va_profile: " << va_profile;
     return nullptr;
   }
 
@@ -306,15 +306,17 @@
 bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) {
   static bool vaapi_functions_initialized = PostSandboxInitialization();
   if (!vaapi_functions_initialized) {
-    bool running_on_chromeos = false;
-#if defined(OS_CHROMEOS)
+    bool error_level_logging = false;
+#if defined(OS_LINUX)
+    error_level_logging = true;
+#elif defined(OS_CHROMEOS)
     // When chrome runs on linux with chromeos=1, do not log error message
     // without VAAPI libraries.
-    running_on_chromeos = base::SysInfo::IsRunningOnChromeOS();
+    error_level_logging = base::SysInfo::IsRunningOnChromeOS();
 #endif
     static const char kErrorMsg[] = "Failed to initialize VAAPI libs";
-    if (running_on_chromeos)
-      LOG(ERROR) << kErrorMsg;
+    if (error_level_logging)
+      VLOG(1) << kErrorMsg;
     else
       DVLOG(1) << kErrorMsg;
     return false;
@@ -385,7 +387,7 @@
   if (std::find(supported_entrypoints.begin(),
                 supported_entrypoints.end(),
                 entrypoint) == supported_entrypoints.end()) {
-    DVLOG(1) << "Unsupported entrypoint";
+    VLOG(1) << "Unsupported entrypoint";
     return false;
   }
   return true;
@@ -409,8 +411,8 @@
     if (attribs[i].type != required_attribs[i].type ||
         (attribs[i].value & required_attribs[i].value) !=
             required_attribs[i].value) {
-      DVLOG(1) << "Unsupported value " << required_attribs[i].value
-               << " for attribute type " << required_attribs[i].type;
+      VLOG(1) << "Unsupported value " << required_attribs[i].value
+              << " for attribute type " << required_attribs[i].type;
       return false;
     }
   }
diff -uarN chromium-48.0.2535.0.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-48.0.2535.0/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
--- chromium-48.0.2535.0.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc	2015-10-14 09:01:20.000000000 +0200
+++ chromium-48.0.2535.0/content/common/sandbox_linux/bpf_gpu_policy_linux.cc	2015-10-18 13:29:07.942272472 +0200
@@ -21,6 +21,8 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
+// Auto-generated for dlopen libva libraries
+#include "content/common/gpu/media/va_stubs.h"
 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
 #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
 #include "content/common/set_process_title.h"
@@ -31,6 +33,8 @@
 #include "sandbox/linux/syscall_broker/broker_file_permission.h"
 #include "sandbox/linux/syscall_broker/broker_process.h"
 #include "sandbox/linux/system_headers/linux_syscalls.h"
+#include "third_party/libva/va/va.h"
+#include "third_party/libva/va/va_x11.h"
 
 using sandbox::arch_seccomp_data;
 using sandbox::bpf_dsl::Allow;
@@ -40,6 +44,11 @@
 using sandbox::syscall_broker::BrokerProcess;
 using sandbox::SyscallSets;
 
+using content_common_gpu_media::kModuleVa;
+using content_common_gpu_media::kModuleVa_x11;
+using content_common_gpu_media::InitializeStubs;
+using content_common_gpu_media::StubPathMap;
+
 namespace content {
 
 namespace {
@@ -94,7 +103,7 @@
 
 bool IsAcceleratedVaapiVideoEncodeEnabled() {
   bool accelerated_encode_enabled = false;
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
   const base::CommandLine& command_line =
       *base::CommandLine::ForCurrentProcess();
   accelerated_encode_enabled =
@@ -299,27 +308,41 @@
     // inside the sandbox, so preload them now.
     if (IsAcceleratedVaapiVideoEncodeEnabled() ||
         IsAcceleratedVideoDecodeEnabled()) {
-      const char* I965DrvVideoPath = NULL;
-      const char* I965HybridDrvVideoPath = NULL;
+      VLOG(1) << "Attempting to enable hardware video acceleration.";
+      StubPathMap paths;
+      paths[kModuleVa].push_back("libva.so.1");
+      paths[kModuleVa_x11].push_back("libva-x11.so.1");
+      if (!InitializeStubs(paths)) {
+        VLOG(1) << "Failed to initialize stubs";
+        return false;
+      }
 
-      if (IsArchitectureX86_64()) {
-        I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
-        I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
-      } else if (IsArchitectureI386()) {
-        I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
+      // libva drivers won't get loaded even above two libraries get dlopened.
+      // Thus, libva calls will fail after post sandbox stage.
+      //
+      // To get the va driver loaded before sandboxing, upstream simply dlopen
+      // the hard-coded va driver path because ChromeOS is the only platform
+      // that Google want to support libva.
+      //
+      // While generic linux distros ship va driver as anywhere they want.
+      // Fortunately, the va driver will be loadded when vaInitialize() get
+      // called.
+      // So the following code is to call vaInitialize() before sandboxing.
+      Display* x_display = XOpenDisplay(NULL);
+      VADisplay va_display = vaGetDisplay(x_display);
+      if (!vaDisplayIsValid(va_display)) {
+        VLOG(1) << "Failed to call vaGetDisplay()";
+        return false;
       }
 
-      dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-      if (I965HybridDrvVideoPath)
-        dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-      dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-#if defined(USE_OZONE)
-      dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-#elif defined(USE_X11)
-      dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-#endif
-    }
-  }
+      int major_version, minor_version;
+      if (vaInitialize(va_display, &major_version, &minor_version)
+          != VA_STATUS_SUCCESS) {
+        VLOG(1) << "Failed to call vaInitialize()";
+        return false;
+      }
+    }  // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled()
+  }  // end of IsArchitectureX86_64() || IsArchitectureI386()
 
   return true;
 }
diff -uarN chromium-48.0.2535.0.orig/content/content_common.gypi chromium-48.0.2535.0/content/content_common.gypi
--- chromium-48.0.2535.0.orig/content/content_common.gypi	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/content_common.gypi	2015-10-18 13:19:06.929647164 +0200
@@ -860,7 +860,7 @@
         },
       ],
     }],
-    ['chromeos==1', {
+    ['chromeos==1 or desktop_linux==1', {
       'sources': [
         'common/gpu/media/accelerated_video_decoder.h',
         'common/gpu/media/h264_decoder.cc',
@@ -916,7 +916,7 @@
         'common/gpu/media/tegra_v4l2_device.h',
       ],
     }],
-    ['target_arch != "arm" and chromeos == 1', {
+    ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', {
       'dependencies': [
         '../media/media.gyp:media',
         '../third_party/libyuv/libyuv.gyp:libyuv',
diff -uarN chromium-48.0.2535.0.orig/content/content_gpu.gypi chromium-48.0.2535.0/content/content_gpu.gypi
--- chromium-48.0.2535.0.orig/content/content_gpu.gypi	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/content_gpu.gypi	2015-10-18 13:19:06.940648986 +0200
@@ -38,7 +38,7 @@
         ],
       },
     }],
-    ['target_arch!="arm" and chromeos == 1', {
+    ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', {
       'include_dirs': [
         '<(DEPTH)/third_party/libva',
       ],
diff -uarN chromium-48.0.2535.0.orig/content/content_tests.gypi chromium-48.0.2535.0/content/content_tests.gypi
--- chromium-48.0.2535.0.orig/content/content_tests.gypi	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/content_tests.gypi	2015-10-18 13:19:06.941649152 +0200
@@ -1743,7 +1743,7 @@
           },
         ]
     }],
-    ['chromeos==1 and target_arch != "arm"', {
+    ['(chromeos==1 or desktop_linux==1) and target_arch != "arm"', {
       'targets': [
           {
             'target_name': 'vaapi_jpeg_decoder_unittest',
diff -uarN chromium-48.0.2535.0.orig/content/gpu/gpu_main.cc chromium-48.0.2535.0/content/gpu/gpu_main.cc
--- chromium-48.0.2535.0.orig/content/gpu/gpu_main.cc	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/gpu/gpu_main.cc	2015-10-18 13:19:07.016661587 +0200
@@ -66,7 +66,7 @@
 #include "content/common/sandbox_mac.h"
 #endif
 
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
 #include "content/common/gpu/media/vaapi_wrapper.h"
 #endif
 
@@ -231,7 +231,7 @@
   GetGpuInfoFromCommandLine(gpu_info, command_line);
   gpu_info.in_process_gpu = false;
 
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
   VaapiWrapper::PreSandboxInitialization();
 #endif
 
diff -uarN chromium-48.0.2535.0.orig/content/public/common/content_switches.cc chromium-48.0.2535.0/content/public/common/content_switches.cc
--- chromium-48.0.2535.0.orig/content/public/common/content_switches.cc	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/public/common/content_switches.cc	2015-10-18 13:19:06.948650315 +0200
@@ -920,7 +920,9 @@
 #if defined(OS_CHROMEOS)
 // Disables panel fitting (used for mirror mode).
 const char kDisablePanelFitting[]           = "disable-panel-fitting";
+#endif
 
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
 // Disables VA-API accelerated video encode.
 const char kDisableVaapiAcceleratedVideoEncode[] =
     "disable-vaapi-accelerated-video-encode";
diff -uarN chromium-48.0.2535.0.orig/content/public/common/content_switches.h chromium-48.0.2535.0/content/public/common/content_switches.h
--- chromium-48.0.2535.0.orig/content/public/common/content_switches.h	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/content/public/common/content_switches.h	2015-10-18 13:19:06.949650480 +0200
@@ -272,6 +272,8 @@
 
 #if defined(OS_CHROMEOS)
 CONTENT_EXPORT extern const char kDisablePanelFitting[];
+#endif
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
 CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[];
 #endif
 
diff -uarN chromium-48.0.2535.0.orig/gpu/config/software_rendering_list_json.cc chromium-48.0.2535.0/gpu/config/software_rendering_list_json.cc
--- chromium-48.0.2535.0.orig/gpu/config/software_rendering_list_json.cc	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/gpu/config/software_rendering_list_json.cc	2015-10-18 13:19:06.966653298 +0200
@@ -481,17 +481,6 @@
       ]
     },
     {
-      "id": 48,
-      "description": "Accelerated video decode is unavailable on Linux",
-      "cr_bugs": [137247],
-      "os": {
-        "type": "linux"
-      },
-      "features": [
-        "accelerated_video_decode"
-      ]
-    },
-    {
       "id": 49,
       "description": "NVidia GeForce GT 650M can cause the system to hang with flash 3D",
       "cr_bugs": [140175],
@@ -1039,6 +1028,11 @@
             "op": ">=",
             "value": "3.0"
           }
+        },
+        {
+          "os": {
+            "type": "linux"
+          }
         }
       ],
       "features": [
diff -uarN chromium-48.0.2535.0.orig/media/media.gyp chromium-48.0.2535.0/media/media.gyp
--- chromium-48.0.2535.0.orig/media/media.gyp	2015-10-14 09:01:21.000000000 +0200
+++ chromium-48.0.2535.0/media/media.gyp	2015-10-18 13:19:06.950650645 +0200
@@ -759,7 +759,7 @@
           ],
         }],
         # For VaapiVideoEncodeAccelerator.
-        ['target_arch != "arm" and chromeos == 1', {
+        ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', {
           'sources': [
             'filters/h264_bitstream_buffer.cc',
             'filters/h264_bitstream_buffer.h',
@@ -1379,7 +1379,7 @@
             'player_android',
           ],
         }],
-        ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
+        ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', {
           'sources': [
             'filters/h264_bitstream_buffer_unittest.cc',
           ],