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

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

Issue 2948513003: Revert of ozone/drm: Only reuse ScanoutBuffers with compatible modifiers (Closed)
Patch Set: Created 3 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/gpu/gbm_buffer.h ('k') | ui/ozone/platform/drm/gpu/gbm_buffer_base.h » ('j') | 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 int GbmBuffer::GetOffset(size_t index) const { 76 int GbmBuffer::GetOffset(size_t index) const {
77 DCHECK_LT(index, planes_.size()); 77 DCHECK_LT(index, planes_.size());
78 return planes_[index].offset; 78 return planes_[index].offset;
79 } 79 }
80 80
81 size_t GbmBuffer::GetSize(size_t index) const { 81 size_t GbmBuffer::GetSize(size_t index) const {
82 DCHECK_LT(index, planes_.size()); 82 DCHECK_LT(index, planes_.size());
83 return planes_[index].size; 83 return planes_[index].size;
84 } 84 }
85 85
86 uint64_t GbmBuffer::GetFormatModifier(size_t index) const {
87 DCHECK_LT(index, planes_.size());
88 return planes_[index].modifier;
89 }
90
86 // TODO(reveman): This should not be needed once crbug.com/597932 is fixed, 91 // TODO(reveman): This should not be needed once crbug.com/597932 is fixed,
87 // as the size would be queried directly from the underlying bo. 92 // as the size would be queried directly from the underlying bo.
88 gfx::Size GbmBuffer::GetSize() const { 93 gfx::Size GbmBuffer::GetSize() const {
89 return size_; 94 return size_;
90 } 95 }
91 96
92 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferForBO( 97 scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferForBO(
93 const scoped_refptr<GbmDevice>& gbm, 98 const scoped_refptr<GbmDevice>& gbm,
94 gbm_bo* bo, 99 gbm_bo* bo,
95 uint32_t format, 100 uint32_t format,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i)))); 243 base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i))));
239 if (!scoped_fd.is_valid()) { 244 if (!scoped_fd.is_valid()) {
240 PLOG(ERROR) << "dup"; 245 PLOG(ERROR) << "dup";
241 return gfx::NativePixmapHandle(); 246 return gfx::NativePixmapHandle();
242 } 247 }
243 handle.fds.emplace_back( 248 handle.fds.emplace_back(
244 base::FileDescriptor(scoped_fd.release(), true /* auto_close */)); 249 base::FileDescriptor(scoped_fd.release(), true /* auto_close */));
245 } 250 }
246 handle.planes.emplace_back(buffer_->GetStride(i), buffer_->GetOffset(i), 251 handle.planes.emplace_back(buffer_->GetStride(i), buffer_->GetOffset(i),
247 buffer_->GetSize(i), 252 buffer_->GetSize(i),
248 buffer_->GetFormatModifier()); 253 buffer_->GetFormatModifier(i));
249 } 254 }
250 return handle; 255 return handle;
251 } 256 }
252 257
253 GbmPixmap::~GbmPixmap() { 258 GbmPixmap::~GbmPixmap() {
254 } 259 }
255 260
256 void* GbmPixmap::GetEGLClientBuffer() const { 261 void* GbmPixmap::GetEGLClientBuffer() const {
257 return nullptr; 262 return nullptr;
258 } 263 }
(...skipping 12 matching lines...) Expand all
271 276
272 int GbmPixmap::GetDmaBufPitch(size_t plane) const { 277 int GbmPixmap::GetDmaBufPitch(size_t plane) const {
273 return buffer_->GetStride(plane); 278 return buffer_->GetStride(plane);
274 } 279 }
275 280
276 int GbmPixmap::GetDmaBufOffset(size_t plane) const { 281 int GbmPixmap::GetDmaBufOffset(size_t plane) const {
277 return buffer_->GetOffset(plane); 282 return buffer_->GetOffset(plane);
278 } 283 }
279 284
280 uint64_t GbmPixmap::GetDmaBufModifier(size_t plane) const { 285 uint64_t GbmPixmap::GetDmaBufModifier(size_t plane) const {
281 return buffer_->GetFormatModifier(); 286 return buffer_->GetFormatModifier(plane);
282 } 287 }
283 288
284 gfx::BufferFormat GbmPixmap::GetBufferFormat() const { 289 gfx::BufferFormat GbmPixmap::GetBufferFormat() const {
285 return ui::GetBufferFormatFromFourCCFormat(buffer_->GetFormat()); 290 return ui::GetBufferFormatFromFourCCFormat(buffer_->GetFormat());
286 } 291 }
287 292
288 gfx::Size GbmPixmap::GetBufferSize() const { 293 gfx::Size GbmPixmap::GetBufferSize() const {
289 return buffer_->GetSize(); 294 return buffer_->GetSize();
290 } 295 }
291 296
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 DCHECK(!processing_callback_.is_null()); 334 DCHECK(!processing_callback_.is_null());
330 if (!processing_callback_.Run(this, processed_pixmap_)) { 335 if (!processing_callback_.Run(this, processed_pixmap_)) {
331 LOG(ERROR) << "Failed processing NativePixmap"; 336 LOG(ERROR) << "Failed processing NativePixmap";
332 return nullptr; 337 return nullptr;
333 } 338 }
334 339
335 return processed_pixmap_->buffer(); 340 return processed_pixmap_->buffer();
336 } 341 }
337 342
338 } // namespace ui 343 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer.h ('k') | ui/ozone/platform/drm/gpu/gbm_buffer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698