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_SCANOUT_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_SCANOUT_BUFFER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_SCANOUT_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_SCANOUT_BUFFER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 class DrmDevice; | 15 class DrmDevice; |
16 | 16 |
17 // Abstraction for a DRM buffer that can be scanned-out of. | 17 // Abstraction for a DRM buffer that can be scanned-out of. |
18 class ScanoutBuffer : public base::RefCountedThreadSafe<ScanoutBuffer> { | 18 class ScanoutBuffer : public base::RefCountedThreadSafe<ScanoutBuffer> { |
19 public: | 19 public: |
20 // ID allocated by the KMS API when the buffer is registered (via the handle). | 20 // ID allocated by the KMS API when the buffer is registered (via the handle). |
21 virtual uint32_t GetFramebufferId() const = 0; | 21 virtual uint32_t GetFramebufferId() const = 0; |
22 | 22 |
| 23 // Returns FourCC format representing the way pixel data has been encoded in |
| 24 // memory for the registered framebuffer. This can be used to check if frame |
| 25 // buffer is compatible with a given hardware plane. |
| 26 virtual uint32_t GetFramebufferPixelFormat() const = 0; |
| 27 |
23 // Handle for the buffer. This is received when allocating the buffer. | 28 // Handle for the buffer. This is received when allocating the buffer. |
24 virtual uint32_t GetHandle() const = 0; | 29 virtual uint32_t GetHandle() const = 0; |
25 | 30 |
26 // Size of the buffer. | 31 // Size of the buffer. |
27 virtual gfx::Size GetSize() const = 0; | 32 virtual gfx::Size GetSize() const = 0; |
28 | 33 |
29 // Format of the buffer. | |
30 virtual uint32_t GetFormat() const = 0; | |
31 | |
32 protected: | 34 protected: |
33 virtual ~ScanoutBuffer() {} | 35 virtual ~ScanoutBuffer() {} |
34 | 36 |
35 friend class base::RefCountedThreadSafe<ScanoutBuffer>; | 37 friend class base::RefCountedThreadSafe<ScanoutBuffer>; |
36 }; | 38 }; |
37 | 39 |
38 class ScanoutBufferGenerator { | 40 class ScanoutBufferGenerator { |
39 public: | 41 public: |
40 virtual ~ScanoutBufferGenerator() {} | 42 virtual ~ScanoutBufferGenerator() {} |
41 | 43 |
42 virtual scoped_refptr<ScanoutBuffer> Create( | 44 virtual scoped_refptr<ScanoutBuffer> Create( |
43 const scoped_refptr<DrmDevice>& drm, | 45 const scoped_refptr<DrmDevice>& drm, |
44 const gfx::Size& size) = 0; | 46 const gfx::Size& size) = 0; |
45 }; | 47 }; |
46 | 48 |
47 } // namespace ui | 49 } // namespace ui |
48 | 50 |
49 #endif // UI_OZONE_PLATFORM_DRM_GPU_SCANOUT_BUFFER_H_ | 51 #endif // UI_OZONE_PLATFORM_DRM_GPU_SCANOUT_BUFFER_H_ |
OLD | NEW |