diff options
author | Haixia Shi <hshi@chromium.org> | 2015-04-08 18:32:31 -0700 |
---|---|---|
committer | Haixia Shi <hshi@chromium.org> | 2015-04-09 01:33:50 +0000 |
commit | 641d2eec4c93f9171ee5b471f15a16239ae294ba (patch) | |
tree | 19d3a44ed8959c279669c05fddcb2f902451bc19 | |
parent | da79f4cd851ac14efd99173f2e7a3f5f4ade359b (diff) | |
download | chromium_src-641d2eec4c93f9171ee5b471f15a16239ae294ba.zip chromium_src-641d2eec4c93f9171ee5b471f15a16239ae294ba.tar.gz chromium_src-641d2eec4c93f9171ee5b471f15a16239ae294ba.tar.bz2 |
[Ozone] VAAPI wrapper should open its own render node.
This prevents a double-close problem that arises when libva uses the same drm
fd as gbm.
TODO(hshi): refactor VAAPI wrapper's management of drm file (crbug.com/475250).
BUG=462459
BUG=464628
TEST=verify that video acceleration works and the netflix hang is fixed
R=jorgelo@chromium.org, piman@chromium.org
TBR=hshi@chromium.org
Review URL: https://codereview.chromium.org/1073653003
Cr-Commit-Position: refs/heads/master@{#324329}
(cherry picked from commit b46fe98550d339b8a5e2a56ce77d712499537539)
Review URL: https://codereview.chromium.org/1076683002
Cr-Commit-Position: refs/branch-heads/2311@{#466}
Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474}
-rw-r--r-- | content/common/gpu/media/vaapi_wrapper.cc | 9 | ||||
-rw-r--r-- | content/common/gpu/media/vaapi_wrapper.h | 6 | ||||
-rw-r--r-- | content/common/sandbox_linux/bpf_gpu_policy_linux.cc | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/content/common/gpu/media/vaapi_wrapper.cc b/content/common/gpu/media/vaapi_wrapper.cc index 588fee3..9a0109e 100644 --- a/content/common/gpu/media/vaapi_wrapper.cc +++ b/content/common/gpu/media/vaapi_wrapper.cc @@ -260,10 +260,11 @@ bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) { #if defined(USE_X11) va_display_ = vaGetDisplay(gfx::GetXDisplay()); #elif defined(USE_OZONE) - ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); - ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); - - va_display_ = vaGetDisplayDRM(factory->GetDrmFd()); + const char* kDriRenderNode0Path = "/dev/dri/renderD128"; + drm_file_ = base::File(base::FilePath::FromUTF8Unsafe(kDriRenderNode0Path), + base::File::FLAG_OPEN | base::File::FLAG_READ | + base::File::FLAG_WRITE); + va_display_ = vaGetDisplayDRM(drm_file_.GetPlatformFile()); #endif // USE_X11 if (!vaDisplayIsValid(va_display_)) { diff --git a/content/common/gpu/media/vaapi_wrapper.h b/content/common/gpu/media/vaapi_wrapper.h index d21f3f1..1322319 100644 --- a/content/common/gpu/media/vaapi_wrapper.h +++ b/content/common/gpu/media/vaapi_wrapper.h @@ -13,6 +13,7 @@ #include <set> #include <vector> +#include "base/files/file.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "content/common/content_export.h" @@ -255,6 +256,11 @@ class CONTENT_EXPORT VaapiWrapper { VAContextID va_vpp_context_id_; VABufferID va_vpp_buffer_id_; +#if defined(USE_OZONE) + // Drm file used to obtain access to the driver interface by VA. + base::File drm_file_; +#endif // USE_OZONE + DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); }; diff --git a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc index f47e703..fe9a834 100644 --- a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc +++ b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc @@ -321,6 +321,7 @@ void GpuProcessPolicy::InitGpuBrokerProcess( const std::vector<BrokerFilePermission>& permissions_extra) { static const char kDriRcPath[] = "/etc/drirc"; static const char kDriCard0Path[] = "/dev/dri/card0"; + static const char kDriRenderNode0Path[] = "/dev/dri/renderD128"; static const char kDevShm[] = "/dev/shm/"; CHECK(broker_process_ == NULL); @@ -328,6 +329,7 @@ void GpuProcessPolicy::InitGpuBrokerProcess( // All GPU process policies need these files brokered out. std::vector<BrokerFilePermission> permissions; permissions.push_back(BrokerFilePermission::ReadWrite(kDriCard0Path)); + permissions.push_back(BrokerFilePermission::ReadWrite(kDriRenderNode0Path)); permissions.push_back(BrokerFilePermission::ReadOnly(kDriRcPath)); if (!IsChromeOS()) { permissions.push_back( |