OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" |
6 | 6 |
7 #include <drm/drm_fourcc.h> | |
8 #include <gbm.h> | |
9 | |
10 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 7 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
11 | 8 |
12 namespace ui { | 9 namespace ui { |
13 namespace { | 10 namespace { |
14 | 11 |
15 const char* kCrtcPropName = "CRTC_ID"; | 12 const char* kCrtcPropName = "CRTC_ID"; |
16 const char* kFbPropName = "FB_ID"; | 13 const char* kFbPropName = "FB_ID"; |
17 const char* kCrtcXPropName = "CRTC_X"; | 14 const char* kCrtcXPropName = "CRTC_X"; |
18 const char* kCrtcYPropName = "CRTC_Y"; | 15 const char* kCrtcYPropName = "CRTC_Y"; |
19 const char* kCrtcWPropName = "CRTC_W"; | 16 const char* kCrtcWPropName = "CRTC_W"; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 src_h_prop_.Initialize(drm, kSrcHPropName, plane_props); | 98 src_h_prop_.Initialize(drm, kSrcHPropName, plane_props); |
102 | 99 |
103 if (!props_init) { | 100 if (!props_init) { |
104 LOG(ERROR) << "Unable to get plane properties."; | 101 LOG(ERROR) << "Unable to get plane properties."; |
105 return false; | 102 return false; |
106 } | 103 } |
107 | 104 |
108 return true; | 105 return true; |
109 } | 106 } |
110 | 107 |
111 bool HardwareDisplayPlaneAtomic::IsSupportedFormat(uint32_t format) const { | |
112 uint32_t format_type = 0; | |
113 switch (format) { | |
114 case GBM_BO_FORMAT_ARGB8888: { | |
115 // We create a FB of 24 bit color depth. | |
116 format_type = DRM_FORMAT_XRGB8888; | |
117 break; | |
118 } | |
119 case GBM_BO_FORMAT_XRGB8888: { | |
120 format_type = DRM_FORMAT_XRGB8888; | |
121 break; | |
122 } | |
123 default: | |
124 NOTREACHED(); | |
125 return false; | |
126 } | |
127 | |
128 for (auto& element : supported_formats_) { | |
129 if (element == format_type) | |
130 return true; | |
131 } | |
132 | |
133 return false; | |
134 } | |
135 | |
136 } // namespace ui | 108 } // namespace ui |
OLD | NEW |