Chromium Code Reviews| 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> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // static | 135 // static |
| 136 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds( | 136 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds( |
| 137 const scoped_refptr<GbmDevice>& gbm, | 137 const scoped_refptr<GbmDevice>& gbm, |
| 138 gfx::BufferFormat format, | 138 gfx::BufferFormat format, |
| 139 const gfx::Size& size, | 139 const gfx::Size& size, |
| 140 std::vector<base::ScopedFD>&& fds, | 140 std::vector<base::ScopedFD>&& fds, |
| 141 const std::vector<int>& strides, | 141 const std::vector<int>& strides, |
| 142 const std::vector<int>& offsets) { | 142 const std::vector<int>& offsets) { |
| 143 TRACE_EVENT2("drm", "GbmBuffer::CreateBufferFromFD", "device", | 143 TRACE_EVENT2("drm", "GbmBuffer::CreateBufferFromFD", "device", |
| 144 gbm->device_path().value(), "size", size.ToString()); | 144 gbm->device_path().value(), "size", size.ToString()); |
| 145 DCHECK_EQ(fds.size(), strides.size()); | 145 DCHECK_LE(fds.size(), strides.size()); |
|
Pawel Osciak
2016/06/24 00:52:54
Should we DCHECK offsets.size() as well (DCHECK_EQ
Daniele Castagna
2016/06/24 01:16:15
Sure, done.
| |
| 146 DCHECK_EQ(fds.size(), 1u); | |
| 147 DCHECK_EQ(offsets[0], 0); | 146 DCHECK_EQ(offsets[0], 0); |
| 148 | 147 |
| 149 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format); | 148 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format); |
| 150 | 149 |
| 151 // Use scanout if supported. | 150 // Use scanout if supported. |
| 152 const std::vector<uint32_t>& scanout_formats = | 151 const std::vector<uint32_t>& scanout_formats = |
| 153 gbm->plane_manager()->GetSupportedFormats(); | 152 gbm->plane_manager()->GetSupportedFormats(); |
| 154 bool use_scanout = std::find(scanout_formats.begin(), scanout_formats.end(), | 153 bool use_scanout = std::find(scanout_formats.begin(), scanout_formats.end(), |
| 155 fourcc_format) != scanout_formats.end(); | 154 fourcc_format) != scanout_formats.end(); |
| 156 gbm_bo* bo = nullptr; | 155 gbm_bo* bo = nullptr; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 DCHECK(!processing_callback_.is_null()); | 288 DCHECK(!processing_callback_.is_null()); |
| 290 if (!processing_callback_.Run(this, processed_pixmap_)) { | 289 if (!processing_callback_.Run(this, processed_pixmap_)) { |
| 291 LOG(ERROR) << "Failed processing NativePixmap"; | 290 LOG(ERROR) << "Failed processing NativePixmap"; |
| 292 return nullptr; | 291 return nullptr; |
| 293 } | 292 } |
| 294 | 293 |
| 295 return processed_pixmap_->buffer(); | 294 return processed_pixmap_->buffer(); |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace ui | 297 } // namespace ui |
| OLD | NEW |