Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / hardware_display_plane.h
blobfd3061816d8b9d9498e05635c8a074732ee9a933
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.
5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_
8 #include <stddef.h>
9 #include <stdint.h>
11 #include "base/basictypes.h"
12 #include "ui/ozone/ozone_export.h"
13 #include "ui/ozone/platform/drm/common/scoped_drm_types.h"
15 namespace gfx {
16 class Rect;
19 namespace ui {
21 class DrmDevice;
23 class OZONE_EXPORT HardwareDisplayPlane {
24 public:
25 enum Type { kDummy, kPrimary, kOverlay, kCursor };
27 HardwareDisplayPlane(uint32_t plane_id, uint32_t possible_crtcs);
29 virtual ~HardwareDisplayPlane();
31 bool Initialize(DrmDevice* drm,
32 const std::vector<uint32_t>& formats,
33 bool is_dummy,
34 bool test_only);
36 bool IsSupportedFormat(uint32_t format);
38 bool CanUseForCrtc(uint32_t crtc_index);
40 bool in_use() const { return in_use_; }
41 void set_in_use(bool in_use) { in_use_ = in_use; }
43 uint32_t plane_id() const { return plane_id_; }
45 Type type() const { return type_; }
47 void set_owning_crtc(uint32_t crtc) { owning_crtc_ = crtc; }
48 uint32_t owning_crtc() const { return owning_crtc_; }
50 protected:
51 virtual bool InitializeProperties(
52 DrmDevice* drm,
53 const ScopedDrmObjectPropertyPtr& plane_props);
55 uint32_t plane_id_ = 0;
56 uint32_t possible_crtcs_ = 0;
57 uint32_t owning_crtc_ = 0;
58 uint32_t last_used_format_ = 0;
59 bool in_use_ = false;
60 Type type_ = kPrimary;
61 std::vector<uint32_t> supported_formats_;
63 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlane);
66 } // namespace ui
68 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_