OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
10 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Allocates the backing pixels and wraps them in |surface_|. |info| is used | 25 // Allocates the backing pixels and wraps them in |surface_|. |info| is used |
26 // to describe the buffer characteristics (size, color format). | 26 // to describe the buffer characteristics (size, color format). |
27 // |should_register_framebuffer| is used to distinguish the buffers that are | 27 // |should_register_framebuffer| is used to distinguish the buffers that are |
28 // used for modesetting. | 28 // used for modesetting. |
29 bool Initialize(const SkImageInfo& info, bool should_register_framebuffer); | 29 bool Initialize(const SkImageInfo& info, bool should_register_framebuffer); |
30 | 30 |
31 SkCanvas* GetCanvas() const; | 31 SkCanvas* GetCanvas() const; |
32 | 32 |
33 // ScanoutBuffer: | 33 // ScanoutBuffer: |
34 uint32_t GetFramebufferId() const override; | 34 uint32_t GetFramebufferId() const override; |
| 35 uint32_t GetFramebufferPixelFormat() const override; |
35 uint32_t GetHandle() const override; | 36 uint32_t GetHandle() const override; |
36 gfx::Size GetSize() const override; | 37 gfx::Size GetSize() const override; |
37 uint32_t GetFormat() const override; | |
38 | 38 |
39 protected: | 39 protected: |
40 ~DrmBuffer() override; | 40 ~DrmBuffer() override; |
41 | 41 |
42 scoped_refptr<DrmDevice> drm_; | 42 scoped_refptr<DrmDevice> drm_; |
43 | 43 |
44 // Length of a row of pixels. | 44 // Length of a row of pixels. |
45 uint32_t stride_ = 0; | 45 uint32_t stride_ = 0; |
46 | 46 |
47 // Buffer handle used by the DRM allocator. | 47 // Buffer handle used by the DRM allocator. |
48 uint32_t handle_ = 0; | 48 uint32_t handle_ = 0; |
49 | 49 |
50 // Base address for memory mapping. | 50 // Base address for memory mapping. |
51 void* mmap_base_ = 0; | 51 void* mmap_base_ = 0; |
52 | 52 |
53 // Size for memory mapping. | 53 // Size for memory mapping. |
54 size_t mmap_size_ = 0; | 54 size_t mmap_size_ = 0; |
55 | 55 |
56 // Buffer ID used by the DRM modesettings API. This is set when the buffer is | 56 // Buffer ID used by the DRM modesettings API. This is set when the buffer is |
57 // registered with the CRTC. | 57 // registered with the CRTC. |
58 uint32_t framebuffer_ = 0; | 58 uint32_t framebuffer_ = 0; |
59 | 59 |
| 60 // Pixel format of |framebuffer_| |
| 61 uint32_t fb_pixel_format_ = 0; |
| 62 |
60 // Wrapper around the native pixel memory. | 63 // Wrapper around the native pixel memory. |
61 skia::RefPtr<SkSurface> surface_; | 64 skia::RefPtr<SkSurface> surface_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(DrmBuffer); | 66 DISALLOW_COPY_AND_ASSIGN(DrmBuffer); |
64 }; | 67 }; |
65 | 68 |
66 class OZONE_EXPORT DrmBufferGenerator : public ScanoutBufferGenerator { | 69 class OZONE_EXPORT DrmBufferGenerator : public ScanoutBufferGenerator { |
67 public: | 70 public: |
68 DrmBufferGenerator(); | 71 DrmBufferGenerator(); |
69 ~DrmBufferGenerator() override; | 72 ~DrmBufferGenerator() override; |
70 | 73 |
71 // ScanoutBufferGenerator: | 74 // ScanoutBufferGenerator: |
72 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DrmDevice>& drm, | 75 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DrmDevice>& drm, |
73 const gfx::Size& size) override; | 76 const gfx::Size& size) override; |
74 | 77 |
75 private: | 78 private: |
76 DISALLOW_COPY_AND_ASSIGN(DrmBufferGenerator); | 79 DISALLOW_COPY_AND_ASSIGN(DrmBufferGenerator); |
77 }; | 80 }; |
78 | 81 |
79 } // namespace ui | 82 } // namespace ui |
80 | 83 |
81 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ | 84 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_ |
OLD | NEW |