1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ui/ozone/platform/dri/crtc_state.h"
6
7#include "ui/ozone/platform/dri/dri_wrapper.h"
8
9namespace ui {
10
11CrtcState::CrtcState(DriWrapper* drm,
12                     uint32_t crtc,
13                     uint32_t connector)
14    : drm_(drm),
15      crtc_(crtc),
16      connector_(connector),
17      saved_crtc_(drm->GetCrtc(crtc)),
18      is_disabled_(true) {}
19
20CrtcState::~CrtcState() {
21  if (!is_disabled_) {
22    drm_->SetCrtc(saved_crtc_.get(), std::vector<uint32_t>(1, connector_));
23    drm_->SetCursor(crtc_, 0, gfx::Size());
24  }
25}
26
27}  // namespace ui
28