Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_buffer.cc

Issue 2090343005: ui: Fix faulty drm/gbm DCHECKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address posciak's comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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());
146 DCHECK_EQ(fds.size(), 1u); 146 DCHECK_EQ(strides.size(), offsets.size());
147 DCHECK_EQ(offsets[0], 0); 147 DCHECK_EQ(offsets[0], 0);
148 148
149 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format); 149 uint32_t fourcc_format = GetFourCCFormatFromBufferFormat(format);
150 150
151 // Use scanout if supported. 151 // Use scanout if supported.
152 const std::vector<uint32_t>& scanout_formats = 152 const std::vector<uint32_t>& scanout_formats =
153 gbm->plane_manager()->GetSupportedFormats(); 153 gbm->plane_manager()->GetSupportedFormats();
154 bool use_scanout = std::find(scanout_formats.begin(), scanout_formats.end(), 154 bool use_scanout = std::find(scanout_formats.begin(), scanout_formats.end(),
155 fourcc_format) != scanout_formats.end(); 155 fourcc_format) != scanout_formats.end();
156 gbm_bo* bo = nullptr; 156 gbm_bo* bo = nullptr;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 DCHECK(!processing_callback_.is_null()); 289 DCHECK(!processing_callback_.is_null());
290 if (!processing_callback_.Run(this, processed_pixmap_)) { 290 if (!processing_callback_.Run(this, processed_pixmap_)) {
291 LOG(ERROR) << "Failed processing NativePixmap"; 291 LOG(ERROR) << "Failed processing NativePixmap";
292 return nullptr; 292 return nullptr;
293 } 293 }
294 294
295 return processed_pixmap_->buffer(); 295 return processed_pixmap_->buffer();
296 } 296 }
297 297
298 } // namespace ui 298 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698