James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_OZONE_PLATFORM_DRI_SCANOUT_BUFFER_H_ |
| 6 | #define UI_OZONE_PLATFORM_DRI_SCANOUT_BUFFER_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | |
| 10 | #include "base/memory/ref_counted.h" |
| 11 | #include "ui/gfx/geometry/size.h" |
| 12 | |
| 13 | namespace ui { |
| 14 | |
| 15 | // Abstraction for a DRM buffer that can be scanned-out of. |
| 16 | class ScanoutBuffer : public base::RefCounted<ScanoutBuffer> { |
| 17 | public: |
| 18 | // ID allocated by the KMS API when the buffer is registered (via the handle). |
| 19 | virtual uint32_t GetFramebufferId() const = 0; |
| 20 | |
| 21 | // Handle for the buffer. This is received when allocating the buffer. |
| 22 | virtual uint32_t GetHandle() const = 0; |
| 23 | |
| 24 | // Size of the buffer. |
| 25 | virtual gfx::Size GetSize() const = 0; |
| 26 | |
| 27 | protected: |
| 28 | virtual ~ScanoutBuffer() {} |
| 29 | |
| 30 | friend class base::RefCounted<ScanoutBuffer>; |
| 31 | }; |
| 32 | |
| 33 | class ScanoutBufferGenerator { |
| 34 | public: |
| 35 | virtual ~ScanoutBufferGenerator() {} |
| 36 | |
| 37 | virtual scoped_refptr<ScanoutBuffer> Create(const gfx::Size& size) = 0; |
| 38 | }; |
| 39 | |
| 40 | } // namespace ui |
| 41 | |
| 42 | #endif // UI_OZONE_PLATFORM_DRI_SCANOUT_BUFFER_H_ |