| 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/gpu/gbm_buffer.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
| 6 | 6 |
| 7 #include <drm.h> | 7 #include <drm.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <gbm.h> | 9 #include <gbm.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/posix/eintr_wrapper.h" | 13 #include "base/posix/eintr_wrapper.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "ui/gfx/geometry/size_conversions.h" | 15 #include "ui/gfx/geometry/size_conversions.h" |
| 16 #include "ui/gfx/native_pixmap_handle_ozone.h" | 16 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| 17 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 17 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 18 #include "ui/ozone/platform/drm/gpu/gbm_device.h" | 18 #include "ui/ozone/platform/drm/gpu/gbm_device.h" |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 int GetGbmFormatFromBufferFormat(gfx::BufferFormat fmt) { | 24 int GetGbmFormatFromBufferFormat(gfx::BufferFormat fmt) { |
| 25 switch (fmt) { | 25 switch (fmt) { |
| 26 case gfx::BufferFormat::BGRA_8888: | 26 case gfx::BufferFormat::BGRA_8888: |
| 27 return GBM_BO_FORMAT_ARGB8888; | 27 return GBM_FORMAT_ARGB8888; |
| 28 case gfx::BufferFormat::BGRX_8888: | 28 case gfx::BufferFormat::BGRX_8888: |
| 29 return GBM_BO_FORMAT_XRGB8888; | 29 return GBM_FORMAT_XRGB8888; |
| 30 default: | 30 default: |
| 31 NOTREACHED(); | 31 NOTREACHED(); |
| 32 return 0; | 32 return 0; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 GbmBuffer::GbmBuffer(const scoped_refptr<GbmDevice>& gbm, | 38 GbmBuffer::GbmBuffer(const scoped_refptr<GbmDevice>& gbm, |
| 39 gbm_bo* bo, | 39 gbm_bo* bo, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 gfx::Size pixmap_size = buffer_->GetSize(); | 160 gfx::Size pixmap_size = buffer_->GetSize(); |
| 161 // If the required size is not integer-sized, round it to the next integer. | 161 // If the required size is not integer-sized, round it to the next integer. |
| 162 *required_size = gfx::ToCeiledSize( | 162 *required_size = gfx::ToCeiledSize( |
| 163 gfx::SizeF(display_bounds.width() / crop_rect.width(), | 163 gfx::SizeF(display_bounds.width() / crop_rect.width(), |
| 164 display_bounds.height() / crop_rect.height())); | 164 display_bounds.height() / crop_rect.height())); |
| 165 return pixmap_size != *required_size; | 165 return pixmap_size != *required_size; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace ui | 168 } // namespace ui |
| OLD | NEW |