OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gfx/linux/native_pixmap_dmabuf.h" |
| 6 |
| 7 namespace gfx { |
| 8 |
| 9 NativePixmapDmaBuf::NativePixmapDmaBuf(const gfx::Size& size, |
| 10 gfx::BufferFormat format, |
| 11 const gfx::NativePixmapHandle& handle) |
| 12 : size_(size), format_(format) { |
| 13 for (auto& fd : handle.fds) { |
| 14 fds_.emplace_back(fd.fd); |
| 15 } |
| 16 |
| 17 for (const auto& plane : handle.planes) { |
| 18 planes_.push_back(plane); |
| 19 } |
| 20 } |
| 21 |
| 22 NativePixmapDmaBuf::~NativePixmapDmaBuf() {} |
| 23 |
| 24 void* NativePixmapDmaBuf::GetEGLClientBuffer() const { |
| 25 return nullptr; |
| 26 } |
| 27 |
| 28 bool NativePixmapDmaBuf::AreDmaBufFdsValid() const { |
| 29 if (fds_.empty()) |
| 30 return false; |
| 31 |
| 32 for (const auto& fd : fds_) { |
| 33 if (fd.get() == -1) |
| 34 return false; |
| 35 } |
| 36 return true; |
| 37 } |
| 38 |
| 39 size_t NativePixmapDmaBuf::GetDmaBufFdCount() const { |
| 40 return fds_.size(); |
| 41 } |
| 42 |
| 43 int NativePixmapDmaBuf::GetDmaBufFd(size_t index) const { |
| 44 DCHECK_LT(index, fds_.size()); |
| 45 return fds_[index].get(); |
| 46 } |
| 47 |
| 48 int NativePixmapDmaBuf::GetDmaBufPitch(size_t index) const { |
| 49 DCHECK_LT(index, planes_.size()); |
| 50 return planes_[index].stride; |
| 51 } |
| 52 |
| 53 int NativePixmapDmaBuf::GetDmaBufOffset(size_t index) const { |
| 54 DCHECK_LT(index, planes_.size()); |
| 55 return planes_[index].offset; |
| 56 } |
| 57 |
| 58 uint64_t NativePixmapDmaBuf::GetDmaBufModifier(size_t index) const { |
| 59 DCHECK_LT(index, planes_.size()); |
| 60 return planes_[index].modifier; |
| 61 } |
| 62 |
| 63 gfx::BufferFormat NativePixmapDmaBuf::GetBufferFormat() const { |
| 64 return format_; |
| 65 } |
| 66 |
| 67 gfx::Size NativePixmapDmaBuf::GetBufferSize() const { |
| 68 return size_; |
| 69 } |
| 70 |
| 71 bool NativePixmapDmaBuf::ScheduleOverlayPlane( |
| 72 gfx::AcceleratedWidget widget, |
| 73 int plane_z_order, |
| 74 gfx::OverlayTransform plane_transform, |
| 75 const gfx::Rect& display_bounds, |
| 76 const gfx::RectF& crop_rect) { |
| 77 return false; |
| 78 } |
| 79 |
| 80 void NativePixmapDmaBuf::SetProcessingCallback( |
| 81 const ProcessingCallback& processing_callback) {} |
| 82 |
| 83 gfx::NativePixmapHandle NativePixmapDmaBuf::ExportHandle() { |
| 84 return gfx::NativePixmapHandle(); |
| 85 } |
| 86 |
| 87 } // namespace gfx |
OLD | NEW |