OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ |
6 #define UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ | 6 #define UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" | 11 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
12 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" | 12 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" |
13 | 13 |
14 typedef struct _drmModeModeInfo drmModeModeInfo; | 14 typedef struct _drmModeModeInfo drmModeModeInfo; |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Point; | 17 class Point; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 // Representation of the information required to initialize and configure a | 22 // Representation of the information required to initialize and configure a |
23 // native display. |index| is the position of the connection and will be | 23 // native display. |index| is the position of the connection and will be |
24 // used to generate a unique identifier for the display. | 24 // used to generate a unique identifier for the display. |
25 class HardwareDisplayControllerInfo { | 25 class HardwareDisplayControllerInfo { |
26 public: | 26 public: |
27 HardwareDisplayControllerInfo(ScopedDrmConnectorPtr connector, | 27 HardwareDisplayControllerInfo(ScopedDrmConnectorPtr connector, |
28 ScopedDrmCrtcPtr crtc, | 28 ScopedDrmCrtcPtr crtc, |
29 size_t index); | 29 size_t index); |
30 ~HardwareDisplayControllerInfo(); | |
31 | 30 |
32 drmModeConnector* connector() const { return connector_.get(); } | 31 drmModeConnector* connector() const { return connector_.get(); } |
33 drmModeCrtc* crtc() const { return crtc_.get(); } | 32 drmModeCrtc* crtc() const { return crtc_.get(); } |
34 size_t index() const { return index_; } | 33 size_t index() const { return index_; } |
35 | 34 |
36 private: | 35 private: |
37 ScopedDrmConnectorPtr connector_; | 36 ScopedDrmConnectorPtr connector_; |
38 ScopedDrmCrtcPtr crtc_; | 37 ScopedDrmCrtcPtr crtc_; |
39 size_t index_; | 38 size_t index_; |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerInfo); | |
42 }; | 39 }; |
43 | 40 |
44 // Looks-up and parses the native display configurations returning all available | 41 // Looks-up and parses the native display configurations returning all available |
45 // displays. | 42 // displays. |
46 ScopedVector<HardwareDisplayControllerInfo> GetAvailableDisplayControllerInfos( | 43 std::vector<HardwareDisplayControllerInfo> GetAvailableDisplayControllerInfos( |
47 int fd); | 44 int fd); |
48 | 45 |
49 bool SameMode(const drmModeModeInfo& lhs, const drmModeModeInfo& rhs); | 46 bool SameMode(const drmModeModeInfo& lhs, const drmModeModeInfo& rhs); |
50 | 47 |
51 DisplayMode_Params CreateDisplayModeParams(const drmModeModeInfo& mode); | 48 DisplayMode_Params CreateDisplayModeParams(const drmModeModeInfo& mode); |
52 | 49 |
53 // |info| provides the DRM information related to the display, |fd| is the | 50 // |info| provides the DRM information related to the display, |fd| is the |
54 // connection to the DRM device. | 51 // connection to the DRM device. |
55 DisplaySnapshot_Params CreateDisplaySnapshotParams( | 52 DisplaySnapshot_Params CreateDisplaySnapshotParams( |
56 HardwareDisplayControllerInfo* info, | 53 const HardwareDisplayControllerInfo& info, |
57 int fd, | 54 int fd, |
58 size_t device_index, | 55 size_t device_index, |
59 const gfx::Point& origin); | 56 const gfx::Point& origin); |
60 | 57 |
61 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format); | 58 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format); |
62 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format); | 59 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format); |
63 | 60 |
64 } // namespace ui | 61 } // namespace ui |
65 | 62 |
66 #endif // UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ | 63 #endif // UI_OZONE_PLATFORM_DRM_COMMON_DRM_UTIL_H_ |
OLD | NEW |