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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // static | 145 // static |
146 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds( | 146 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds( |
147 const scoped_refptr<GbmDevice>& gbm, | 147 const scoped_refptr<GbmDevice>& gbm, |
148 gfx::BufferFormat format, | 148 gfx::BufferFormat format, |
149 const gfx::Size& size, | 149 const gfx::Size& size, |
150 std::vector<base::ScopedFD>&& fds, | 150 std::vector<base::ScopedFD>&& fds, |
151 const std::vector<gfx::NativePixmapPlane>& planes) { | 151 const std::vector<gfx::NativePixmapPlane>& planes) { |
152 TRACE_EVENT2("drm", "GbmBuffer::CreateBufferFromFD", "device", | 152 TRACE_EVENT2("drm", "GbmBuffer::CreateBufferFromFD", "device", |
153 gbm->device_path().value(), "size", size.ToString()); | 153 gbm->device_path().value(), "size", size.ToString()); |
154 DCHECK_LE(fds.size(), planes.size()); | 154 DCHECK_LE(fds.size(), planes.size()); |
155 DCHECK_EQ(planes[0].offset, 0); | 155 DCHECK_EQ(planes[0].offset, 0u); |
156 | 156 |
157 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format); | 157 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format); |
158 | 158 |
159 // Use scanout if supported. | 159 // Use scanout if supported. |
160 bool use_scanout = gbm_device_is_format_supported( | 160 bool use_scanout = gbm_device_is_format_supported( |
161 gbm->device(), fourcc_format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | 161 gbm->device(), fourcc_format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); |
162 | 162 |
163 gbm_bo* bo = nullptr; | 163 gbm_bo* bo = nullptr; |
164 if (use_scanout) { | 164 if (use_scanout) { |
165 struct gbm_import_fd_data fd_data; | 165 struct gbm_import_fd_data fd_data; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 DCHECK(!processing_callback_.is_null()); | 302 DCHECK(!processing_callback_.is_null()); |
303 if (!processing_callback_.Run(this, processed_pixmap_)) { | 303 if (!processing_callback_.Run(this, processed_pixmap_)) { |
304 LOG(ERROR) << "Failed processing NativePixmap"; | 304 LOG(ERROR) << "Failed processing NativePixmap"; |
305 return nullptr; | 305 return nullptr; |
306 } | 306 } |
307 | 307 |
308 return processed_pixmap_->buffer(); | 308 return processed_pixmap_->buffer(); |
309 } | 309 } |
310 | 310 |
311 } // namespace ui | 311 } // namespace ui |
OLD | NEW |