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

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

Issue 2052003006: More YVU_420 buffers support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/ozone/platform/drm/client_native_pixmap_factory_gbm.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void GbmPixmap::SetProcessingCallback( 157 void GbmPixmap::SetProcessingCallback(
158 const ProcessingCallback& processing_callback) { 158 const ProcessingCallback& processing_callback) {
159 DCHECK(processing_callback_.is_null()); 159 DCHECK(processing_callback_.is_null());
160 processing_callback_ = processing_callback; 160 processing_callback_ = processing_callback;
161 } 161 }
162 162
163 gfx::NativePixmapHandle GbmPixmap::ExportHandle() { 163 gfx::NativePixmapHandle GbmPixmap::ExportHandle() {
164 gfx::NativePixmapHandle handle; 164 gfx::NativePixmapHandle handle;
165 for (size_t i = 0; 165 for (size_t i = 0;
166 i < gfx::NumberOfPlanesForBufferFormat(buffer_->GetFormat()); ++i) { 166 i < gfx::NumberOfPlanesForBufferFormat(buffer_->GetFormat()); ++i) {
167 base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i)))); 167 if (i < buffer_->GetFdCount()) {
dnicoara 2016/06/13 13:41:17 nit: Would you mind adding a comment explaining wh
Daniele Castagna 2016/06/13 17:07:58 Done.
168 if (!scoped_fd.is_valid()) { 168 base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i))));
169 PLOG(ERROR) << "dup"; 169 if (!scoped_fd.is_valid()) {
170 return gfx::NativePixmapHandle(); 170 PLOG(ERROR) << "dup";
171 return gfx::NativePixmapHandle();
172 }
173 handle.fds.emplace_back(
174 base::FileDescriptor(scoped_fd.release(), true /* auto_close */));
171 } 175 }
172 handle.fds.emplace_back(
173 base::FileDescriptor(scoped_fd.release(), true /* auto_close */));
174 handle.strides_and_offsets.emplace_back(buffer_->GetStride(i), 176 handle.strides_and_offsets.emplace_back(buffer_->GetStride(i),
175 buffer_->GetOffset(i)); 177 buffer_->GetOffset(i));
176 } 178 }
177 return handle; 179 return handle;
178 } 180 }
179 181
180 GbmPixmap::~GbmPixmap() { 182 GbmPixmap::~GbmPixmap() {
181 } 183 }
182 184
183 void* GbmPixmap::GetEGLClientBuffer() const { 185 void* GbmPixmap::GetEGLClientBuffer() const {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 DCHECK(!processing_callback_.is_null()); 256 DCHECK(!processing_callback_.is_null());
255 if (!processing_callback_.Run(this, processed_pixmap_)) { 257 if (!processing_callback_.Run(this, processed_pixmap_)) {
256 LOG(ERROR) << "Failed processing NativePixmap"; 258 LOG(ERROR) << "Failed processing NativePixmap";
257 return nullptr; 259 return nullptr;
258 } 260 }
259 261
260 return processed_pixmap_->buffer(); 262 return processed_pixmap_->buffer();
261 } 263 }
262 264
263 } // namespace ui 265 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698