OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #ifndef UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/buffer_types.h" |
| 11 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/ozone/public/client_native_pixmap.h" |
| 13 #include "ui/ozone/public/native_pixmap.h" |
| 14 |
| 15 typedef struct _drm_intel_bo drm_intel_bo; |
| 16 |
| 17 namespace ui { |
| 18 |
| 19 class IntelDrmPixmap : public NativePixmap { |
| 20 public: |
| 21 static scoped_refptr<IntelDrmPixmap> Create( |
| 22 const base::FileDescriptor& device_fd, |
| 23 gfx::BufferFormat format, |
| 24 const gfx::Size& size); |
| 25 |
| 26 // NativePixmap: |
| 27 void* GetEGLClientBuffer() override; |
| 28 int GetDmaBufFd() override; |
| 29 int GetDmaBufPitch() override; |
| 30 |
| 31 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 32 int plane_z_order, |
| 33 gfx::OverlayTransform plane_transform, |
| 34 const gfx::Rect& display_bounds, |
| 35 const gfx::RectF& crop_rect) override; |
| 36 void SetScalingCallback(const ScalingCallback& scaling_callback) override; |
| 37 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; |
| 38 gfx::NativePixmapHandle ExportHandle() override; |
| 39 |
| 40 private: |
| 41 IntelDrmPixmap(); |
| 42 ~IntelDrmPixmap() override; |
| 43 |
| 44 bool Initialize(const base::FileDescriptor& device_fd, |
| 45 gfx::BufferFormat format, |
| 46 const gfx::Size& size); |
| 47 |
| 48 drm_intel_bo* buffer_; |
| 49 base::ScopedFD prime_fd_; |
| 50 uint32 stride_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(IntelDrmPixmap); |
| 53 }; |
| 54 |
| 55 class IntelDrmClientPixmap : public ClientNativePixmap { |
| 56 public: |
| 57 static scoped_ptr<IntelDrmClientPixmap> CreateFromHandle( |
| 58 const gfx::NativePixmapHandle& handle, |
| 59 const base::FileDescriptor& device_fd, |
| 60 gfx::BufferFormat format, |
| 61 const gfx::Size& size); |
| 62 ~IntelDrmClientPixmap() override; |
| 63 |
| 64 // CilentNativePixmap: |
| 65 bool Map(void** data) override; |
| 66 void Unmap() override; |
| 67 void GetStride(int* stride) const override; |
| 68 |
| 69 private: |
| 70 IntelDrmClientPixmap(); |
| 71 |
| 72 bool InitializeFromHandle(const gfx::NativePixmapHandle& handle, |
| 73 const base::FileDescriptor& device_fd, |
| 74 gfx::BufferFormat format, |
| 75 const gfx::Size& size); |
| 76 |
| 77 drm_intel_bo* buffer_; |
| 78 base::ScopedFD prime_fd_; |
| 79 uint32 stride_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(IntelDrmClientPixmap); |
| 82 }; |
| 83 |
| 84 } // namespace ui |
| 85 |
| 86 #endif // UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
OLD | NEW |