| 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_DRM_DMABUF_PIXMAP_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_DMABUF_PIXMAP_H_ |
| 7 |
| 8 #include "base/files/scoped_file.h" |
| 9 #include "base/macros.h" |
| 10 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 11 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 12 #include "ui/ozone/public/native_pixmap.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 class DrmDevice; |
| 17 |
| 18 // DrmDmabufPixmap is a reference to a dmabuf file descriptor. |
| 19 // 'Pixmap' not 'buffer' because we have a size (width and height). |
| 20 class DrmDmabufPixmap : public ScanoutBuffer { |
| 21 public: |
| 22 DrmDmabufPixmap(const scoped_refptr<DrmDevice>& drm); |
| 23 ~DrmDmabufPixmap() override; |
| 24 |
| 25 bool Initialize(base::ScopedFD dma_buf, |
| 26 int width, |
| 27 int height, |
| 28 uint32_t pitch); |
| 29 |
| 30 // ScanoutBuffer: |
| 31 uint32_t GetFramebufferId() const override; |
| 32 uint32_t GetHandle() const override; |
| 33 gfx::Size GetSize() const override; |
| 34 |
| 35 int GetDmaBufFd() const; |
| 36 int GetDmaBufPitch() const; |
| 37 |
| 38 private: |
| 39 scoped_refptr<DrmDevice> drm_; |
| 40 |
| 41 // PRIME file descriptor. |
| 42 base::ScopedFD dma_buf_; |
| 43 uint32_t dma_buf_pitch_ = -1; |
| 44 |
| 45 // Local gem handle for the file descriptior. |
| 46 uint32_t handle_ = 0; |
| 47 |
| 48 // Framebuffer ID for scanout. |
| 49 uint32_t framebuffer_ = 0; |
| 50 |
| 51 int width_ = 0; |
| 52 int height_ = 0; |
| 53 }; |
| 54 |
| 55 class DrmDmabufPixmapWrapper : public NativePixmap { |
| 56 public: |
| 57 DrmDmabufPixmapWrapper(ScreenManager* screen_manager, |
| 58 const scoped_refptr<DrmDmabufPixmap>& pixmap); |
| 59 ~DrmDmabufPixmapWrapper() override; |
| 60 |
| 61 // NativePixmap |
| 62 void* /* EGLClientBuffer */ GetEGLClientBuffer() override; |
| 63 int GetDmaBufFd() override; |
| 64 int GetDmaBufPitch() override; |
| 65 |
| 66 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 67 int plane_z_order, |
| 68 gfx::OverlayTransform plane_transform, |
| 69 const gfx::Rect& display_bounds, |
| 70 const gfx::RectF& crop_rect) override; |
| 71 |
| 72 private: |
| 73 scoped_refptr<DrmDmabufPixmap> pixmap_; |
| 74 ScreenManager* screen_manager_; |
| 75 }; |
| 76 |
| 77 } // namespace ui |
| 78 |
| 79 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_DMABUF_PIXMAP_H_ |
| OLD | NEW |