Chromium Code Reviews| 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/geometry/size.h" | |
| 11 #include "ui/ozone/public/native_pixmap.h" | |
| 12 #include "ui/ozone/public/surface_factory_ozone.h" | |
| 13 | |
| 14 typedef struct _drm_intel_bo drm_intel_bo; | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 class IntelDrmPixmap : public NativePixmap { | |
|
dshwang
2015/06/29 17:22:05
All code using Intel DRM are in this class. Both G
| |
| 19 public: | |
| 20 static scoped_refptr<IntelDrmPixmap> Create( | |
| 21 base::FileDescriptor device_fd, | |
| 22 SurfaceFactoryOzone::BufferFormat format, | |
| 23 const gfx::Size& size); | |
| 24 | |
| 25 // Renderer uses this API. | |
| 26 static scoped_refptr<IntelDrmPixmap> CreateFromHandle( | |
| 27 base::FileDescriptor device_fd, | |
| 28 base::FileDescriptor handle, | |
| 29 SurfaceFactoryOzone::BufferFormat format, | |
| 30 const gfx::Size& size); | |
| 31 | |
| 32 // NativePixmap: | |
| 33 void* GetEGLClientBuffer() override; | |
| 34 int GetDmaBufFd() override; | |
| 35 int GetDmaBufPitch() override; | |
| 36 | |
| 37 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | |
| 38 int plane_z_order, | |
| 39 gfx::OverlayTransform plane_transform, | |
| 40 const gfx::Rect& display_bounds, | |
| 41 const gfx::RectF& crop_rect) override; | |
| 42 void SetScalingCallback(const ScalingCallback& scaling_callback) override; | |
| 43 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; | |
| 44 BufferUsage GetBufferUsage() const override; | |
| 45 void* Map() override; | |
| 46 void Unmap() override; | |
| 47 | |
| 48 private: | |
| 49 IntelDrmPixmap(); | |
| 50 ~IntelDrmPixmap() override; | |
| 51 | |
| 52 bool Initialize(base::FileDescriptor device_fd, | |
| 53 SurfaceFactoryOzone::BufferFormat format, | |
| 54 const gfx::Size& size); | |
| 55 bool InitializeFromHandle(base::FileDescriptor device_fd, | |
| 56 base::FileDescriptor handle, | |
| 57 SurfaceFactoryOzone::BufferFormat format, | |
| 58 const gfx::Size& size); | |
| 59 | |
| 60 drm_intel_bo* buffer_; | |
| 61 base::ScopedFD prime_fd_; | |
| 62 uint32 stride_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(IntelDrmPixmap); | |
| 65 }; | |
| 66 | |
| 67 } // namespace ui | |
| 68 | |
| 69 #endif // UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ | |
| OLD | NEW |