Commit f00c0c1c authored by kalyan.kondapally's avatar kalyan.kondapally Committed by Commit bot

Remove Virtual Terminal Manager.

VT is disabled with Freon. VTM is not really needed anymore and thus removing this.

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

Cr-Commit-Position: refs/heads/master@{#302519}
parent 19687827
......@@ -58,8 +58,6 @@ source_set("dri_common") {
"screen_manager.cc",
"screen_manager.h",
"scanout_buffer.h",
"virtual_terminal_manager.cc",
"virtual_terminal_manager.h",
]
deps = [
......
......@@ -84,8 +84,6 @@
'screen_manager.cc',
'screen_manager.h',
'scanout_buffer.h',
'virtual_terminal_manager.cc',
'virtual_terminal_manager.h',
],
'conditions': [
['use_drm_atomic_flip==1', {
......
......@@ -21,7 +21,6 @@
#include "ui/ozone/platform/dri/dri_wrapper.h"
#include "ui/ozone/platform/dri/native_display_delegate_dri.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/platform/dri/virtual_terminal_manager.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/ui_thread_gpu.h"
......@@ -38,8 +37,7 @@ const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
class OzonePlatformDri : public OzonePlatform {
public:
OzonePlatformDri()
: vt_manager_(new VirtualTerminalManager()),
dri_(new DriWrapper(kDefaultGraphicsCardPath)),
: dri_(new DriWrapper(kDefaultGraphicsCardPath)),
buffer_generator_(new DriBufferGenerator(dri_.get())),
screen_manager_(new ScreenManager(dri_.get(),
buffer_generator_.get())),
......@@ -104,7 +102,6 @@ class OzonePlatformDri : public OzonePlatform {
virtual void InitializeGPU() override {}
private:
scoped_ptr<VirtualTerminalManager> vt_manager_;
scoped_ptr<DriWrapper> dri_;
scoped_ptr<DriBufferGenerator> buffer_generator_;
scoped_ptr<ScreenManager> screen_manager_;
......
......@@ -27,7 +27,6 @@
#include "ui/ozone/platform/dri/native_display_delegate_proxy.h"
#include "ui/ozone/platform/dri/scanout_buffer.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/platform/dri/virtual_terminal_manager.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/gpu_platform_support.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
......@@ -112,7 +111,6 @@ class OzonePlatformGbm : public OzonePlatform {
gpu_platform_support_host_.get(), device_manager_.get()));
}
virtual void InitializeUI() override {
vt_manager_.reset(new VirtualTerminalManager());
// Needed since the browser process creates the accelerated widgets and that
// happens through SFO.
surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
......@@ -152,7 +150,6 @@ class OzonePlatformGbm : public OzonePlatform {
private:
bool use_surfaceless_;
scoped_ptr<VirtualTerminalManager> vt_manager_;
scoped_ptr<DriWrapper> dri_;
scoped_ptr<GbmBufferGenerator> buffer_generator_;
scoped_ptr<ScreenManager> screen_manager_;
......
// Copyright 2014 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/dri/virtual_terminal_manager.h"
#include <errno.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <linux/vt.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "base/logging.h"
namespace ui {
namespace {
const char kTTYDevice[] = "/dev/tty1";
const int kVT = 1;
} // namespace
VirtualTerminalManager::VirtualTerminalManager() {
// Use the current console.
fd_ = open(kTTYDevice, O_RDWR | O_CLOEXEC, 0);
if (fd_ < 0)
LOG(ERROR) << "Failed to open '" << kTTYDevice << "' " << strerror(errno);
if (ioctl(fd_, VT_ACTIVATE, kVT) || ioctl(fd_, VT_WAITACTIVE, kVT))
LOG(ERROR) << "Failed to switch to VT: " << kVT
<< " error: " << strerror(errno);;
if (ioctl(fd_, KDGETMODE, &vt_mode_))
LOG(ERROR) << "Failed to get VT mode: " << strerror(errno);
if (ioctl(fd_, KDSETMODE, KD_GRAPHICS))
LOG(ERROR) << "Failed to set graphics mode: " << strerror(errno);
if (tcgetattr(fd_, &terminal_attributes_))
LOG(ERROR) << "Failed to get terminal attributes";
// Stop the TTY from processing keys and echo-ing them to the terminal.
struct termios raw_attributes = terminal_attributes_;
cfmakeraw(&raw_attributes);
raw_attributes.c_oflag |= OPOST;
if (tcsetattr(fd_, TCSANOW, &raw_attributes))
LOG(ERROR) << "Failed to set raw attributes";
if (ioctl(fd_, KDGKBMODE, &previous_keyboard_mode_))
LOG(ERROR) << "Failed to get keyboard mode";
if (ioctl(fd_, KDSKBMODE, K_OFF) && ioctl(fd_, KDSKBMODE, K_RAW))
LOG(ERROR) << "Failed to set keyboard mode";
}
VirtualTerminalManager::~VirtualTerminalManager() {
if (fd_ < 0)
return;
if (ioctl(fd_, KDSETMODE, &vt_mode_))
LOG(ERROR) << "Failed to restore VT mode";
if (ioctl(fd_, KDSKBMODE, previous_keyboard_mode_))
LOG(ERROR) << "Failed to restore keyboard mode";
if (tcsetattr(fd_, TCSANOW, &terminal_attributes_))
LOG(ERROR) << "Failed to restore terminal attributes";
close(fd_);
}
} // namespace ui
// Copyright 2014 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_DRI_VIRTUAL_TERMINAL_MANAGER_H_
#define UI_OZONE_PLATFORM_DRI_VIRTUAL_TERMINAL_MANAGER_H_
#include <termios.h>
#include "base/basictypes.h"
namespace ui {
class VirtualTerminalManager {
public:
VirtualTerminalManager();
~VirtualTerminalManager();
private:
int fd_;
int vt_mode_;
int previous_keyboard_mode_;
struct termios terminal_attributes_;
DISALLOW_COPY_AND_ASSIGN(VirtualTerminalManager);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRI_VIRTUAL_TERMINAL_MANAGER_H_
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