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.h> | |
8 #include <drm/drm_fourcc.h> | |
9 #include <errno.h> | 7 #include <errno.h> |
10 #include <gbm.h> | 8 #include <gbm.h> |
11 #include <xf86drm.h> | 9 #include <xf86drm.h> |
12 | 10 |
13 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 11 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
14 | 12 |
15 namespace ui { | 13 namespace ui { |
16 namespace { | 14 namespace { |
17 | 15 |
18 const char* kCrtcPropName = "CRTC_ID"; | 16 const char* kCrtcPropName = "CRTC_ID"; |
(...skipping 97 matching lines...) Loading... |
116 return false; | 114 return false; |
117 } | 115 } |
118 | 116 |
119 supported_formats_ = formats; | 117 supported_formats_ = formats; |
120 if (is_dummy()) | 118 if (is_dummy()) |
121 supported_formats_.push_back(DRM_FORMAT_XRGB8888); | 119 supported_formats_.push_back(DRM_FORMAT_XRGB8888); |
122 | 120 |
123 return true; | 121 return true; |
124 } | 122 } |
125 | 123 |
126 bool HardwareDisplayPlaneAtomic::IsSupportedFormat(uint32_t format) const { | |
127 uint32_t format_type = 0; | |
128 switch (format) { | |
129 case GBM_BO_FORMAT_ARGB8888: { | |
130 // We create a FB of 24 bit color depth. | |
131 format_type = DRM_FORMAT_XRGB8888; | |
132 break; | |
133 } | |
134 case GBM_BO_FORMAT_XRGB8888: { | |
135 format_type = DRM_FORMAT_XRGB8888; | |
136 break; | |
137 } | |
138 default: | |
139 NOTREACHED(); | |
140 return false; | |
141 } | |
142 | |
143 for (auto& element : supported_formats_) { | |
144 if (element == format_type) | |
145 return true; | |
146 } | |
147 | |
148 return false; | |
149 } | |
150 | |
151 } // namespace ui | 124 } // namespace ui |
OLD | NEW |