| Index: ui/gfx/linux/native_pixmap_dmabuf.cc
|
| diff --git a/ui/gfx/linux/native_pixmap_dmabuf.cc b/ui/gfx/linux/native_pixmap_dmabuf.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..edd5a77aa8cb6adaf6f73c7bae971ed9e45cb5fb
|
| --- /dev/null
|
| +++ b/ui/gfx/linux/native_pixmap_dmabuf.cc
|
| @@ -0,0 +1,87 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/gfx/linux/native_pixmap_dmabuf.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +NativePixmapDmaBuf::NativePixmapDmaBuf(const gfx::Size& size,
|
| + gfx::BufferFormat format,
|
| + const gfx::NativePixmapHandle& handle)
|
| + : size_(size), format_(format) {
|
| + for (auto& fd : handle.fds) {
|
| + fds_.emplace_back(fd.fd);
|
| + }
|
| +
|
| + for (const auto& plane : handle.planes) {
|
| + planes_.push_back(plane);
|
| + }
|
| +}
|
| +
|
| +NativePixmapDmaBuf::~NativePixmapDmaBuf() {}
|
| +
|
| +void* NativePixmapDmaBuf::GetEGLClientBuffer() const {
|
| + return nullptr;
|
| +}
|
| +
|
| +bool NativePixmapDmaBuf::AreDmaBufFdsValid() const {
|
| + if (fds_.empty())
|
| + return false;
|
| +
|
| + for (const auto& fd : fds_) {
|
| + if (fd.get() == -1)
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +size_t NativePixmapDmaBuf::GetDmaBufFdCount() const {
|
| + return fds_.size();
|
| +}
|
| +
|
| +int NativePixmapDmaBuf::GetDmaBufFd(size_t index) const {
|
| + DCHECK_LT(index, fds_.size());
|
| + return fds_[index].get();
|
| +}
|
| +
|
| +int NativePixmapDmaBuf::GetDmaBufPitch(size_t index) const {
|
| + DCHECK_LT(index, planes_.size());
|
| + return planes_[index].stride;
|
| +}
|
| +
|
| +int NativePixmapDmaBuf::GetDmaBufOffset(size_t index) const {
|
| + DCHECK_LT(index, planes_.size());
|
| + return planes_[index].offset;
|
| +}
|
| +
|
| +uint64_t NativePixmapDmaBuf::GetDmaBufModifier(size_t index) const {
|
| + DCHECK_LT(index, planes_.size());
|
| + return planes_[index].modifier;
|
| +}
|
| +
|
| +gfx::BufferFormat NativePixmapDmaBuf::GetBufferFormat() const {
|
| + return format_;
|
| +}
|
| +
|
| +gfx::Size NativePixmapDmaBuf::GetBufferSize() const {
|
| + return size_;
|
| +}
|
| +
|
| +bool NativePixmapDmaBuf::ScheduleOverlayPlane(
|
| + gfx::AcceleratedWidget widget,
|
| + int plane_z_order,
|
| + gfx::OverlayTransform plane_transform,
|
| + const gfx::Rect& display_bounds,
|
| + const gfx::RectF& crop_rect) {
|
| + return false;
|
| +}
|
| +
|
| +void NativePixmapDmaBuf::SetProcessingCallback(
|
| + const ProcessingCallback& processing_callback) {}
|
| +
|
| +gfx::NativePixmapHandle NativePixmapDmaBuf::ExportHandle() {
|
| + return gfx::NativePixmapHandle();
|
| +}
|
| +
|
| +} // namespace gfx
|
|
|