Index: ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
diff --git a/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h b/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..05ac3f386b6afac2a672e340bc71a02f1dc8e254 |
--- /dev/null |
+++ b/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
@@ -0,0 +1,86 @@ |
+// Copyright 2015 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_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
+#define UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "ui/gfx/buffer_types.h" |
+#include "ui/gfx/geometry/size.h" |
+#include "ui/ozone/public/client_native_pixmap.h" |
+#include "ui/ozone/public/native_pixmap.h" |
+ |
+typedef struct _drm_intel_bo drm_intel_bo; |
+ |
+namespace ui { |
+ |
+class IntelDrmPixmap : public NativePixmap { |
+ public: |
+ static scoped_refptr<IntelDrmPixmap> Create( |
+ const base::FileDescriptor& device_fd, |
+ gfx::BufferFormat format, |
+ const gfx::Size& size); |
+ |
+ // NativePixmap: |
+ void* GetEGLClientBuffer() override; |
+ int GetDmaBufFd() override; |
+ int GetDmaBufPitch() 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 SetScalingCallback(const ScalingCallback& scaling_callback) override; |
+ scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; |
+ gfx::NativePixmapHandle ExportHandle() override; |
+ |
+ private: |
+ IntelDrmPixmap(); |
+ ~IntelDrmPixmap() override; |
+ |
+ bool Initialize(const base::FileDescriptor& device_fd, |
+ gfx::BufferFormat format, |
+ const gfx::Size& size); |
+ |
+ drm_intel_bo* buffer_; |
+ base::ScopedFD prime_fd_; |
+ uint32 stride_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(IntelDrmPixmap); |
+}; |
+ |
+class IntelDrmClientPixmap : public ClientNativePixmap { |
+ public: |
+ static scoped_ptr<IntelDrmClientPixmap> CreateFromHandle( |
+ const gfx::NativePixmapHandle& handle, |
+ const base::FileDescriptor& device_fd, |
+ gfx::BufferFormat format, |
+ const gfx::Size& size); |
+ ~IntelDrmClientPixmap() override; |
+ |
+ // CilentNativePixmap: |
+ bool Map(void** data) override; |
+ void Unmap() override; |
+ void GetStride(int* stride) const override; |
+ |
+ private: |
+ IntelDrmClientPixmap(); |
+ |
+ bool InitializeFromHandle(const gfx::NativePixmapHandle& handle, |
+ const base::FileDescriptor& device_fd, |
+ gfx::BufferFormat format, |
+ const gfx::Size& size); |
+ |
+ drm_intel_bo* buffer_; |
+ base::ScopedFD prime_fd_; |
+ uint32 stride_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(IntelDrmClientPixmap); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |