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_DRM_UTIL_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_UTIL_H_
8 #include "base/files/file_path.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_vector.h"
12 #include "ui/ozone/platform/drm/gpu/scoped_drm_types.h"
14 typedef struct _drmModeModeInfo drmModeModeInfo
;
21 // Representation of the information required to initialize and configure a
23 class HardwareDisplayControllerInfo
{
25 HardwareDisplayControllerInfo(ScopedDrmConnectorPtr connector
,
26 ScopedDrmCrtcPtr crtc
);
27 ~HardwareDisplayControllerInfo();
29 drmModeConnector
* connector() const { return connector_
.get(); }
30 drmModeCrtc
* crtc() const { return crtc_
.get(); }
33 ScopedDrmConnectorPtr connector_
;
34 ScopedDrmCrtcPtr crtc_
;
36 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerInfo
);
39 // Looks-up and parses the native display configurations returning all available
41 ScopedVector
<HardwareDisplayControllerInfo
> GetAvailableDisplayControllerInfos(
44 bool SameMode(const drmModeModeInfo
& lhs
, const drmModeModeInfo
& rhs
);
46 // Memory maps a DRM buffer.
47 bool MapDumbBuffer(int fd
, uint32_t handle
, uint32_t size
, void** pixels
);
49 void ForceInitializationOfPrimaryDisplay(const scoped_refptr
<DrmDevice
>& drm
,
50 ScreenManager
* screen_manager
);
52 base::FilePath
GetPrimaryDisplayCardPath();
56 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_UTIL_H_