Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / platform / dri / crtc_state.h
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 #ifndef UI_OZONE_PLATFORM_DRI_CRTC_STATE_H_
6 #define UI_OZONE_PLATFORM_DRI_CRTC_STATE_H_
7
8 #include <stdint.h>
9
10 #include "ui/ozone/platform/dri/scoped_drm_types.h"
11
12 namespace ui {
13
14 class DriWrapper;
15
16 // Represents the state of a CRTC.
17 //
18 // One CRTC can be paired up with one or more connectors. The simplest
19 // configuration represents one CRTC driving one monitor, while pairing up a
20 // CRTC with multiple connectors results in hardware mirroring.
21 class CrtcState {
22  public:
23   CrtcState(DriWrapper* drm, uint32_t crtc, uint32_t connector);
24   ~CrtcState();
25
26   uint32_t crtc() const { return crtc_; }
27   uint32_t connector() const { return connector_; }
28   bool is_disabled() const { return is_disabled_; }
29
30   void set_is_disabled(bool state) { is_disabled_ = state; }
31
32  private:
33   DriWrapper* drm_;  // Not owned.
34
35   uint32_t crtc_;
36
37   // TODO(dnicoara) Add support for hardware mirroring (multiple connectors).
38   uint32_t connector_;
39
40   // Store the state of the CRTC before we took over. Used to restore the CRTC
41   // once we no longer need it.
42   ScopedDrmCrtcPtr saved_crtc_;
43
44   // Keeps track of the CRTC state. If a surface has been bound, then the value
45   // is set to false. Otherwise it is true.
46   bool is_disabled_;
47
48   DISALLOW_COPY_AND_ASSIGN(CrtcState);
49 };
50
51 }  // namespace ui
52
53 #endif  // UI_OZONE_PLATFORM_DRI_CRTC_STATE_H_