Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/common/sandbox_linux/bpf_gpu_policy_linux.cc

Issue 1743543004: Enable Accelerated Video Decode in Linux Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cast_shell_linux build fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h" 5 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 if (IsArchitectureX86_64() || IsArchitectureI386()) { 298 if (IsArchitectureX86_64() || IsArchitectureI386()) {
299 // Accelerated video dlopen()'s some shared objects 299 // Accelerated video dlopen()'s some shared objects
300 // inside the sandbox, so preload them now. 300 // inside the sandbox, so preload them now.
301 if (IsAcceleratedVaapiVideoEncodeEnabled() || 301 if (IsAcceleratedVaapiVideoEncodeEnabled() ||
302 IsAcceleratedVideoDecodeEnabled()) { 302 IsAcceleratedVideoDecodeEnabled()) {
303 const char* I965DrvVideoPath = NULL; 303 const char* I965DrvVideoPath = NULL;
304 const char* I965HybridDrvVideoPath = NULL; 304 const char* I965HybridDrvVideoPath = NULL;
305 305
306 if (IsArchitectureX86_64()) { 306 if (IsArchitectureX86_64()) {
307 #if defined(OS_CHROMEOS)
Jorge Lucangeli Obes 2016/02/26 18:02:44 Use the "IsChromeOS" function here.
dshwang 2016/02/26 18:15:34 Done.
307 I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; 308 I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
308 I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; 309 I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
310 #else
311 I965DrvVideoPath = "/usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so";
Jorge Lucangeli Obes 2016/02/26 18:02:44 Is this path guaranteed to be correct?
dshwang 2016/02/26 18:15:34 no, it depends on linux distribution. I have next
Jorge Lucangeli Obes 2016/02/26 18:19:31 I don't have a preference, just pointing out that
dshwang 2016/02/26 18:34:59 Added TODO comment. The script will cover ChromeOS
312 #endif
309 } else if (IsArchitectureI386()) { 313 } else if (IsArchitectureI386()) {
310 I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; 314 I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
311 } 315 }
312 316
313 dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); 317 dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
314 if (I965HybridDrvVideoPath) 318 if (I965HybridDrvVideoPath)
315 dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); 319 dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
316 dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); 320 dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
317 #if defined(USE_OZONE) 321 #if defined(USE_OZONE)
318 dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); 322 dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 361 }
358 362
359 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions); 363 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions);
360 // The initialization callback will perform generic initialization and then 364 // The initialization callback will perform generic initialization and then
361 // call broker_sandboxer_callback. 365 // call broker_sandboxer_callback.
362 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, 366 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox,
363 broker_sandboxer_allocator))); 367 broker_sandboxer_allocator)));
364 } 368 }
365 369
366 } // namespace content 370 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698