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

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

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/BUILD.gn ('k') | ui/gfx/linux/native_pixmap_dmabuf.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/linux/native_pixmap_dmabuf.h
diff --git a/ui/gfx/linux/native_pixmap_dmabuf.h b/ui/gfx/linux/native_pixmap_dmabuf.h
new file mode 100644
index 0000000000000000000000000000000000000000..8489129af9b66649b7a19f9508eeb87cf394900e
--- /dev/null
+++ b/ui/gfx/linux/native_pixmap_dmabuf.h
@@ -0,0 +1,86 @@
+// 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.
+
+#ifndef UI_GFX_LINUX_NATIVE_PIXMAP_DMABUF_H_
+#define UI_GFX_LINUX_NATIVE_PIXMAP_DMABUF_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/files/scoped_file.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "ui/gfx/client_native_pixmap.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/native_pixmap.h"
+
+namespace gfx {
+
+class GFX_EXPORT NativePixmapDmabufHelper
+ : public base::RefCountedThreadSafe<NativePixmapDmabufHelper> {
+ public:
+ explicit NativePixmapDmabufHelper(const gfx::NativePixmapHandle& handle);
+ NativePixmapDmabufHelper(std::vector<base::ScopedFD>&& fds,
+ const std::vector<gfx::NativePixmapPlane>&& planes);
+
+ bool AreFdsValid() const;
+ size_t GetFdCount() const;
+ int GetFd(size_t plane) const;
+ int GetStride(size_t plane) const;
+ int GetOffset(size_t plane) const;
+ size_t GetSize(size_t plane) const;
+ uint64_t GetFormatModifier(size_t plane) const;
+
+ private:
+ friend class base::RefCountedThreadSafe<NativePixmapDmabufHelper>;
+
+ ~NativePixmapDmabufHelper();
+
+ std::vector<base::ScopedFD> fds_;
+ std::vector<gfx::NativePixmapPlane> planes_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativePixmapDmabufHelper);
+};
+
+class GFX_EXPORT NativePixmapDmaBuf : public gfx::NativePixmap {
+ public:
+ NativePixmapDmaBuf(const gfx::Size& size,
+ gfx::BufferFormat format,
+ const scoped_refptr<NativePixmapDmabufHelper>& helper);
+
+ // NativePixmap:
+ void* GetEGLClientBuffer() const override;
+ bool AreDmaBufFdsValid() const override;
+ size_t GetDmaBufFdCount() const override;
+ int GetDmaBufFd(size_t plane) const override;
+ int GetDmaBufPitch(size_t plane) const override;
+ int GetDmaBufOffset(size_t plane) const override;
+ uint64_t GetDmaBufModifier(size_t plane) const override;
+ gfx::BufferFormat GetBufferFormat() const override;
+ gfx::Size GetBufferSize() const override;
+ bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
+ int plane_z_order,
+ gfx::OverlayTransform plane_transform,
+ const gfx::Rect& display_bounds,
+ const gfx::RectF& crop_rect) override;
+ void SetProcessingCallback(
+ const ProcessingCallback& processing_callback) override;
+ gfx::NativePixmapHandle ExportHandle() override;
+
+ protected:
+ ~NativePixmapDmaBuf() override;
+
+ private:
+ gfx::Size size_;
+ gfx::BufferFormat format_;
+
+ scoped_refptr<gfx::NativePixmapDmabufHelper> helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativePixmapDmaBuf);
+};
+
+} // namespace gfx
+
+#endif // UI_GFX_LINUX_NATIVE_PIXMAP_DMABUF_H_
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/linux/native_pixmap_dmabuf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698