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_VGEM_PIXMAP_H_ | |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_VGEM_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 // VgemPixmap is a reference to a dmabuf file descriptor. | |
|
cdotstout
2016/02/01 19:06:05
Not in love with the name I used here. How about
Forrest Reiling
2016/02/10 19:13:35
Done.
| |
| 19 // 'Pixmap' not 'buffer' because we have a size (width and height). | |
| 20 class VgemPixmap : public ScanoutBuffer { | |
| 21 public: | |
| 22 VgemPixmap(const scoped_refptr<DrmDevice>& drm); | |
| 23 ~VgemPixmap() 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 VgemPixmapWrapper : public NativePixmap { | |
| 56 public: | |
| 57 VgemPixmapWrapper(ScreenManager* screen_manager, | |
| 58 const scoped_refptr<VgemPixmap>& pixmap); | |
| 59 ~VgemPixmapWrapper() 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<VgemPixmap> pixmap_; | |
| 74 ScreenManager* screen_manager_; | |
| 75 }; | |
| 76 | |
| 77 } // namespace ui | |
| 78 | |
| 79 #endif // UI_OZONE_PLATFORM_DRM_GPU_VGEM_PIXMAP_H_ | |
| OLD | NEW |