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

Unified Diff: content/common/gpu/media/vaapi_wrapper.cc

Issue 1137483002: VAAPI Wrapper: refactor management of drm file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/vaapi_wrapper.cc
diff --git a/content/common/gpu/media/vaapi_wrapper.cc b/content/common/gpu/media/vaapi_wrapper.cc
index 219e370e5bdc29475be4555ccc20660528d03500..c30c58dfce2610652a7f1a95ec990b0b286746df 100644
--- a/content/common/gpu/media/vaapi_wrapper.cc
+++ b/content/common/gpu/media/vaapi_wrapper.cc
@@ -62,6 +62,11 @@ namespace content {
// and not taken from HW documentation.
const int kMaxEncoderFramerate = 30;
+#if defined(USE_OZONE)
+base::LazyInstance<base::File>
+ VaapiWrapper::drm_file_ = LAZY_INSTANCE_INITIALIZER;
+#endif
+
base::LazyInstance<VaapiWrapper::LazyProfileInfos>
VaapiWrapper::profile_infos_ = LAZY_INSTANCE_INITIALIZER;
@@ -317,11 +322,7 @@ bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) {
#if defined(USE_X11)
va_display_ = vaGetDisplay(gfx::GetXDisplay());
#elif defined(USE_OZONE)
- 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());
+ va_display_ = vaGetDisplayDRM(drm_file_.Get().GetPlatformFile());
dnicoara 2015/05/07 21:17:09 Previously, weren't we crashing because of double
hshi1 2015/05/07 21:50:17 The double close (bug 464628) was because we're us
dnicoara 2015/05/07 22:04:27 Are you sure VAApiWrapper is shared? If I open mul
#endif // USE_X11
if (!vaDisplayIsValid(va_display_)) {
@@ -1042,6 +1043,17 @@ void VaapiWrapper::DeinitializeVpp() {
}
// static
+void VaapiWrapper::PreSandboxInitialization() {
+#if defined(USE_OZONE)
+ const char* kDriRenderNode0Path = "/dev/dri/renderD128";
+ drm_file_.Get().Initialize(
+ base::FilePath::FromUTF8Unsafe(kDriRenderNode0Path),
+ base::File::FLAG_OPEN | base::File::FLAG_READ |
+ base::File::FLAG_WRITE);
+#endif
+}
+
+// static
bool VaapiWrapper::PostSandboxInitialization() {
StubPathMap paths;

Powered by Google App Engine
This is Rietveld 408576698