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 #include "ui/ozone/platform/drm/common/drm_util.h" | 5 #include "ui/ozone/platform/drm/common/drm_util.h" |
6 | 6 |
7 #include <drm_fourcc.h> | 7 #include <drm_fourcc.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (!params.has_native_mode && !params.modes.empty()) { | 266 if (!params.has_native_mode && !params.modes.empty()) { |
267 params.has_native_mode = true; | 267 params.has_native_mode = true; |
268 params.native_mode = params.modes.front(); | 268 params.native_mode = params.modes.front(); |
269 } | 269 } |
270 | 270 |
271 return params; | 271 return params; |
272 } | 272 } |
273 | 273 |
274 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { | 274 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { |
275 switch (format) { | 275 switch (format) { |
| 276 case gfx::BufferFormat::RGBA_8888: |
| 277 return DRM_FORMAT_ABGR8888; |
| 278 case gfx::BufferFormat::RGBX_8888: |
| 279 return DRM_FORMAT_XBGR8888; |
276 case gfx::BufferFormat::BGRA_8888: | 280 case gfx::BufferFormat::BGRA_8888: |
277 return DRM_FORMAT_ARGB8888; | 281 return DRM_FORMAT_ARGB8888; |
278 case gfx::BufferFormat::BGRX_8888: | 282 case gfx::BufferFormat::BGRX_8888: |
279 return DRM_FORMAT_XRGB8888; | 283 return DRM_FORMAT_XRGB8888; |
280 case gfx::BufferFormat::UYVY_422: | 284 case gfx::BufferFormat::UYVY_422: |
281 return DRM_FORMAT_UYVY; | 285 return DRM_FORMAT_UYVY; |
282 default: | 286 default: |
283 NOTREACHED(); | 287 NOTREACHED(); |
284 return 0; | 288 return 0; |
285 } | 289 } |
286 } | 290 } |
287 | 291 |
288 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) { | 292 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) { |
289 switch (format) { | 293 switch (format) { |
| 294 case DRM_FORMAT_ABGR8888: |
| 295 return gfx::BufferFormat::RGBA_8888; |
| 296 case DRM_FORMAT_XBGR8888: |
| 297 return gfx::BufferFormat::RGBX_8888; |
290 case DRM_FORMAT_ARGB8888: | 298 case DRM_FORMAT_ARGB8888: |
291 return gfx::BufferFormat::BGRA_8888; | 299 return gfx::BufferFormat::BGRA_8888; |
292 case DRM_FORMAT_XRGB8888: | 300 case DRM_FORMAT_XRGB8888: |
293 return gfx::BufferFormat::BGRX_8888; | 301 return gfx::BufferFormat::BGRX_8888; |
294 case DRM_FORMAT_UYVY: | 302 case DRM_FORMAT_UYVY: |
295 return gfx::BufferFormat::UYVY_422; | 303 return gfx::BufferFormat::UYVY_422; |
296 default: | 304 default: |
297 NOTREACHED(); | 305 NOTREACHED(); |
298 return gfx::BufferFormat::BGRA_8888; | 306 return gfx::BufferFormat::BGRA_8888; |
299 } | 307 } |
300 } | 308 } |
| 309 |
| 310 int GetFourCCFormatForFramebuffer(gfx::BufferFormat format) { |
| 311 // Currently, drm supports 24 bitcolordepth for hardware overlay. |
| 312 switch (format) { |
| 313 case gfx::BufferFormat::RGBA_8888: |
| 314 case gfx::BufferFormat::RGBX_8888: |
| 315 return DRM_FORMAT_XBGR8888; |
| 316 case gfx::BufferFormat::BGRA_8888: |
| 317 case gfx::BufferFormat::BGRX_8888: |
| 318 return DRM_FORMAT_XRGB8888; |
| 319 case gfx::BufferFormat::UYVY_422: |
| 320 return DRM_FORMAT_UYVY; |
| 321 default: |
| 322 NOTREACHED(); |
| 323 return 0; |
| 324 } |
| 325 } |
301 } // namespace ui | 326 } // namespace ui |
OLD | NEW |