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

Unified Diff: ui/gfx/linux/native_pixmap_dmabuf.cc

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Just rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/linux/native_pixmap_dmabuf.h ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..70f50c7859ed8e9e66a5f7dfc624ee1270f6216e
--- /dev/null
+++ b/ui/gfx/linux/native_pixmap_dmabuf.cc
@@ -0,0 +1,127 @@
+// 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 {
+
+NativePixmapDmabufHelper::NativePixmapDmabufHelper(
+ const gfx::NativePixmapHandle& handle) {
+ for (auto& fd : handle.fds) {
+ fds_.emplace_back(fd.fd);
+ }
+
+ for (const auto& plane : handle.planes) {
+ planes_.push_back(plane);
+ }
+}
+
+NativePixmapDmabufHelper::NativePixmapDmabufHelper(
+ std::vector<base::ScopedFD>&& fds,
+ const std::vector<gfx::NativePixmapPlane>&& planes)
+ : fds_(std::move(fds)), planes_(std::move(planes)) {}
+
+NativePixmapDmabufHelper::~NativePixmapDmabufHelper() {}
+
+bool NativePixmapDmabufHelper::AreFdsValid() const {
+ if (fds_.empty())
+ return false;
+
+ for (const auto& fd : fds_) {
+ if (fd.get() == -1)
+ return false;
+ }
+ return true;
+}
+
+size_t NativePixmapDmabufHelper::GetFdCount() const {
+ return fds_.size();
+}
+
+int NativePixmapDmabufHelper::GetFd(size_t index) const {
+ DCHECK_LT(index, fds_.size());
+ return fds_[index].get();
+}
+
+int NativePixmapDmabufHelper::GetStride(size_t index) const {
+ DCHECK_LT(index, planes_.size());
+ return planes_[index].stride;
+}
+
+int NativePixmapDmabufHelper::GetOffset(size_t index) const {
+ DCHECK_LT(index, planes_.size());
+ return planes_[index].offset;
+}
+
+size_t NativePixmapDmabufHelper::GetSize(size_t index) const {
+ DCHECK_LT(index, planes_.size());
+ return planes_[index].size;
+}
+
+uint64_t NativePixmapDmabufHelper::GetFormatModifier(size_t index) const {
+ DCHECK_LT(index, planes_.size());
+ return planes_[index].modifier;
+}
+
+NativePixmapDmaBuf::NativePixmapDmaBuf(
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ const scoped_refptr<NativePixmapDmabufHelper>& helper)
+ : size_(size), format_(format), helper_(helper) {}
+
+NativePixmapDmaBuf::~NativePixmapDmaBuf() {}
+
+void* NativePixmapDmaBuf::GetEGLClientBuffer() const {
+ return nullptr;
+}
+
+bool NativePixmapDmaBuf::AreDmaBufFdsValid() const {
+ return helper_->AreFdsValid();
+}
+
+size_t NativePixmapDmaBuf::GetDmaBufFdCount() const {
+ return helper_->GetFdCount();
+}
+
+int NativePixmapDmaBuf::GetDmaBufFd(size_t plane) const {
+ return helper_->GetFd(plane);
+}
+
+int NativePixmapDmaBuf::GetDmaBufPitch(size_t plane) const {
+ return helper_->GetStride(plane);
+}
+
+int NativePixmapDmaBuf::GetDmaBufOffset(size_t plane) const {
+ return helper_->GetOffset(plane);
+}
+
+uint64_t NativePixmapDmaBuf::GetDmaBufModifier(size_t plane) const {
+ return helper_->GetFormatModifier(plane);
+}
+
+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
« no previous file with comments | « ui/gfx/linux/native_pixmap_dmabuf.h ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698