Commit 58112841 authored by dnicoara's avatar dnicoara Committed by Commit bot

[Ozone-Drm] Remove GPU lock

Workarounds to support grabbing the DRM devices as master after GPU crashes
made the GPU lock unnecessary.

BUG=none

Review URL: https://codereview.chromium.org/1141243002

Cr-Commit-Position: refs/heads/master@{#330146}
parent f9094b37
...@@ -47,8 +47,6 @@ source_set("drm_common") { ...@@ -47,8 +47,6 @@ source_set("drm_common") {
"gpu/drm_vsync_provider.h", "gpu/drm_vsync_provider.h",
"gpu/drm_window.cc", "gpu/drm_window.cc",
"gpu/drm_window.h", "gpu/drm_window.h",
"gpu/gpu_lock.cc",
"gpu/gpu_lock.h",
"gpu/hardware_display_controller.cc", "gpu/hardware_display_controller.cc",
"gpu/hardware_display_controller.h", "gpu/hardware_display_controller.h",
"gpu/hardware_display_plane.cc", "gpu/hardware_display_plane.cc",
......
...@@ -69,8 +69,6 @@ ...@@ -69,8 +69,6 @@
'gpu/drm_vsync_provider.h', 'gpu/drm_vsync_provider.h',
'gpu/drm_window.cc', 'gpu/drm_window.cc',
'gpu/drm_window.h', 'gpu/drm_window.h',
'gpu/gpu_lock.cc',
'gpu/gpu_lock.h',
'gpu/hardware_display_controller.cc', 'gpu/hardware_display_controller.cc',
'gpu/hardware_display_controller.h', 'gpu/hardware_display_controller.h',
'gpu/hardware_display_plane.cc', 'gpu/hardware_display_plane.cc',
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/platform/drm/gpu/gpu_lock.h"
#include <sys/file.h>
#include <unistd.h>
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
namespace ui {
namespace {
const char kGpuLockFile[] = "/run/frecon";
}
GpuLock::GpuLock() {
fd_ = open(kGpuLockFile, O_RDWR);
if (fd_ < 0) {
PLOG(ERROR) << "Failed to open lock file '" << kGpuLockFile << "'";
return;
}
VLOG(1) << "Taking write lock on '" << kGpuLockFile << "'";
if (HANDLE_EINTR(flock(fd_, LOCK_EX)))
PLOG(ERROR) << "Error while trying to get lock on '" << kGpuLockFile << "'";
VLOG(1) << "Done trying to take write lock on '" << kGpuLockFile << "'";
}
GpuLock::~GpuLock() {
// Failed to open the lock file, so nothing to do here.
if (fd_ < 0)
return;
VLOG(1) << "Releasing write lock on '" << kGpuLockFile << "'";
close(fd_);
}
} // namespace ui
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_DRM_GPU_GPU_LOCK_H_
#define UI_OZONE_PLATFORM_DRM_GPU_GPU_LOCK_H_
#include "base/macros.h"
namespace ui {
// Used to synchronize with Frecon and make sure the GPU process isn't trying to
// access the DRM resources before Frecon finishes drawing.
class GpuLock {
public:
GpuLock();
~GpuLock();
private:
int fd_;
DISALLOW_COPY_AND_ASSIGN(GpuLock);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_GPU_GPU_LOCK_H_
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h" #include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h"
#include "ui/ozone/platform/drm/gpu/drm_window.h" #include "ui/ozone/platform/drm/gpu/drm_window.h"
#include "ui/ozone/platform/drm/gpu/gpu_lock.h"
#include "ui/ozone/platform/drm/gpu/screen_manager.h" #include "ui/ozone/platform/drm/gpu/screen_manager.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h" #include "ui/ozone/platform/drm/host/drm_cursor.h"
#include "ui/ozone/platform/drm/host/drm_display_host_manager.h" #include "ui/ozone/platform/drm/host/drm_display_host_manager.h"
...@@ -88,9 +87,6 @@ class OzonePlatformDrm : public OzonePlatform { ...@@ -88,9 +87,6 @@ class OzonePlatformDrm : public OzonePlatform {
new DrmNativeDisplayDelegate(display_manager_.get())); new DrmNativeDisplayDelegate(display_manager_.get()));
} }
void InitializeUI() override { void InitializeUI() override {
#if defined(OS_CHROMEOS)
gpu_lock_.reset(new GpuLock());
#endif
drm_device_manager_.reset(new DrmDeviceManager( drm_device_manager_.reset(new DrmDeviceManager(
scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator()))); scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator())));
window_manager_.reset(new DrmWindowHostManager()); window_manager_.reset(new DrmWindowHostManager());
...@@ -125,7 +121,6 @@ class OzonePlatformDrm : public OzonePlatform { ...@@ -125,7 +121,6 @@ class OzonePlatformDrm : public OzonePlatform {
private: private:
// Objects in the "GPU" process. // Objects in the "GPU" process.
scoped_ptr<GpuLock> gpu_lock_;
scoped_ptr<DrmDeviceManager> drm_device_manager_; scoped_ptr<DrmDeviceManager> drm_device_manager_;
scoped_ptr<DrmBufferGenerator> buffer_generator_; scoped_ptr<DrmBufferGenerator> buffer_generator_;
scoped_ptr<ScreenManager> screen_manager_; scoped_ptr<ScreenManager> screen_manager_;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "ui/ozone/platform/drm/gpu/gbm_buffer.h" #include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
#include "ui/ozone/platform/drm/gpu/gbm_device.h" #include "ui/ozone/platform/drm/gpu/gbm_device.h"
#include "ui/ozone/platform/drm/gpu/gbm_surface.h" #include "ui/ozone/platform/drm/gpu/gbm_surface.h"
#include "ui/ozone/platform/drm/gpu/gpu_lock.h"
#include "ui/ozone/platform/drm/gpu/scanout_buffer.h" #include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
#include "ui/ozone/platform/drm/gpu/screen_manager.h" #include "ui/ozone/platform/drm/gpu/screen_manager.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h" #include "ui/ozone/platform/drm/host/drm_cursor.h"
...@@ -170,9 +169,6 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -170,9 +169,6 @@ class OzonePlatformGbm : public OzonePlatform {
} }
void InitializeGPU() override { void InitializeGPU() override {
#if defined(OS_CHROMEOS)
gpu_lock_.reset(new GpuLock());
#endif
gl_api_loader_.reset(new GlApiLoader()); gl_api_loader_.reset(new GlApiLoader());
drm_device_manager_.reset(new DrmDeviceManager( drm_device_manager_.reset(new DrmDeviceManager(
scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator()))); scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator())));
...@@ -195,7 +191,6 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -195,7 +191,6 @@ class OzonePlatformGbm : public OzonePlatform {
scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
// Objects in the GPU process. // Objects in the GPU process.
scoped_ptr<GpuLock> gpu_lock_;
scoped_ptr<GlApiLoader> gl_api_loader_; scoped_ptr<GlApiLoader> gl_api_loader_;
scoped_ptr<DrmDeviceManager> drm_device_manager_; scoped_ptr<DrmDeviceManager> drm_device_manager_;
scoped_ptr<GbmBufferGenerator> buffer_generator_; scoped_ptr<GbmBufferGenerator> buffer_generator_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment