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_DRI_UTIL_H_ 6 #define UI_OZONE_PLATFORM_DRI_DRI_UTIL_H_ 7 8 #include "base/macros.h" 9 #include "base/memory/scoped_vector.h" 10 #include "ui/ozone/platform/dri/scoped_drm_types.h" 11 12 typedef struct _drmModeModeInfo drmModeModeInfo; 13 14 namespace ui { 15 16 // Representation of the information required to initialize and configure a 17 // native display. 18 class HardwareDisplayControllerInfo { 19 public: 20 HardwareDisplayControllerInfo(ScopedDrmConnectorPtr connector, 21 ScopedDrmCrtcPtr crtc); 22 ~HardwareDisplayControllerInfo(); 23 connector()24 drmModeConnector* connector() const { return connector_.get(); } crtc()25 drmModeCrtc* crtc() const { return crtc_.get(); } 26 27 private: 28 ScopedDrmConnectorPtr connector_; 29 ScopedDrmCrtcPtr crtc_; 30 31 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerInfo); 32 }; 33 34 // Looks-up and parses the native display configurations returning all available 35 // displays. 36 ScopedVector<HardwareDisplayControllerInfo> 37 GetAvailableDisplayControllerInfos(int fd); 38 39 bool SameMode(const drmModeModeInfo& lhs, const drmModeModeInfo& rhs); 40 41 // Memory maps a DRM buffer. 42 bool MapDumbBuffer(int fd, 43 uint32_t handle, 44 uint32_t size, 45 void** pixels); 46 47 } // namespace ui 48 49 #endif // UI_OZONE_PLATFORM_DRI_DRI_UTIL_H_ 50