summarylogtreecommitdiffstats
path: root/chromium_vaapi-other.patch
blob: eaaa2252d59170496675fdd26409c887d07062a2 (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
Patch by me, Samantha McVey <samantham@posteo.net>
Attempt to load these VA-API drivers before sandbox.

diff -aur chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
--- chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc	2016-09-07 18:02:39.000000000 -0700
+++ chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc	2016-09-16 11:46:20.339655906 -0700
@@ -96,7 +96,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 =
@@ -302,19 +302,49 @@
     // inside the sandbox, so preload them now.
     if (IsAcceleratedVaapiVideoEncodeEnabled() ||
         IsAcceleratedVideoDecodeEnabled()) {
-      const char* I965DrvVideoPath = NULL;
-      const char* I965HybridDrvVideoPath = NULL;
+      const char* I965_Drv_Video_Path          = NULL;
+      const char* I965_Hybrid_Drv_Video_Path   = NULL;
+      const char* NVIDIA_Drv_Video_Path        = NULL;
+      const char* LIB_VA_Path                  = NULL;
+      const char* LIB_VA_X11_Path              = NULL;
+      const char* R600_Drv_VideoPath           = NULL;
+      const char* RADEONSI_Drv_VideoPath       = NULL;
+      const char* VDPAU_Drv_VideoPath          = NULL;
+
+      if (IsArchitectureX86_64() || IsArchitectureI386() ) {
+        I965_Drv_Video_Path           = "/usr/lib/dri/i965_drv_video.so";
+        I965_Hybrid_Drv_Video_Path    = "/usr/lib/dri/hybrid_drv_video.so";
+        NVIDIA_Drv_Video_Path         = "/usr/lib/dri/nvidia_drv_video.so";
+        R600_Drv_VideoPath            = "/usr/lib/dri/r600_drv_video.so";
+        VDPAU_Drv_VideoPath           = "/usr/lib/dri/vdpau_drv_video.so";
+        RADEONSI_Drv_VideoPath        = "/usr/lib/dri/radeonsi_drv_video.so";
+        NOUVEAU_Drv_VideoPath         = "/usr/lib/dri/nouveau_drv_video.so";

-      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";
+        LIB_VA_Path    = "/usr/lib/libva.so.1";
+        LIB_VA_X11_Path = "/usr/lib/libva-x11.so.1";
+      }
+      if ( access(I965_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
+          dlopen(I965_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(I965_Hybrid_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
+          dlopen(I965_Hybrid_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(VDPAU_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
+          dlopen(VDPAU_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(NVIDIA_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
+          dlopen(NVIDIA_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(R600_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
+          dlopen(R600_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(RADEONSI_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
+          dlopen(RADEONSI_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+      }
+      if ( access(NOUVEAU_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
+          dlopen(NOUVEAU_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
       }

-      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);