Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/vgem_pixmap.h |
| diff --git a/ui/ozone/platform/drm/gpu/vgem_pixmap.h b/ui/ozone/platform/drm/gpu/vgem_pixmap.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..04ea41ca660e6d399ce900aa3dcf7bf88e2cbb61 |
| --- /dev/null |
| +++ b/ui/ozone/platform/drm/gpu/vgem_pixmap.h |
| @@ -0,0 +1,79 @@ |
| +// 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_VGEM_PIXMAP_H_ |
| +#define UI_OZONE_PLATFORM_DRM_GPU_VGEM_PIXMAP_H_ |
| + |
| +#include "base/files/scoped_file.h" |
| +#include "base/macros.h" |
| +#include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| +#include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| +#include "ui/ozone/public/native_pixmap.h" |
| + |
| +namespace ui { |
| + |
| +class DrmDevice; |
| + |
| +// 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.
|
| +// 'Pixmap' not 'buffer' because we have a size (width and height). |
| +class VgemPixmap : public ScanoutBuffer { |
| + public: |
| + VgemPixmap(const scoped_refptr<DrmDevice>& drm); |
| + ~VgemPixmap() override; |
| + |
| + bool Initialize(base::ScopedFD dma_buf, |
| + int width, |
| + int height, |
| + uint32_t pitch); |
| + |
| + // ScanoutBuffer: |
| + uint32_t GetFramebufferId() const override; |
| + uint32_t GetHandle() const override; |
| + gfx::Size GetSize() const override; |
| + |
| + int GetDmaBufFd() const; |
| + int GetDmaBufPitch() const; |
| + |
| + private: |
| + scoped_refptr<DrmDevice> drm_; |
| + |
| + // PRIME file descriptor. |
| + base::ScopedFD dma_buf_; |
| + uint32_t dma_buf_pitch_ = -1; |
| + |
| + // Local gem handle for the file descriptior. |
| + uint32_t handle_ = 0; |
| + |
| + // Framebuffer ID for scanout. |
| + uint32_t framebuffer_ = 0; |
| + |
| + int width_ = 0; |
| + int height_ = 0; |
| +}; |
| + |
| +class VgemPixmapWrapper : public NativePixmap { |
| + public: |
| + VgemPixmapWrapper(ScreenManager* screen_manager, |
| + const scoped_refptr<VgemPixmap>& pixmap); |
| + ~VgemPixmapWrapper() override; |
| + |
| + // NativePixmap |
| + void* /* EGLClientBuffer */ 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; |
| + |
| + private: |
| + scoped_refptr<VgemPixmap> pixmap_; |
| + ScreenManager* screen_manager_; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_OZONE_PLATFORM_DRM_GPU_VGEM_PIXMAP_H_ |