OLD | NEW |
(Empty) | |
| 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_BUFFER_DATA_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_BUFFER_DATA_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 |
| 10 struct gbm_bo; |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 class DriWrapper; |
| 15 |
| 16 // This class is used to tag a gbm buffer with custom information needed |
| 17 // for presentation with the surface factory. |
| 18 class BufferData { |
| 19 public: |
| 20 // When we create the BufferData we need to register the buffer. Once |
| 21 // successfully registered, the |framebuffer_| field will hold the ID of the |
| 22 // buffer. The controller will use this ID when scanning out the buffer. On |
| 23 // creation we will also associate the BufferData with the buffer. |
| 24 static BufferData* CreateData(DriWrapper* dri, gbm_bo* buffer); |
| 25 |
| 26 // Callback used by GBM to destroy the BufferData associated with a buffer. |
| 27 static void Destroy(gbm_bo* buffer, void* data); |
| 28 |
| 29 // Returns the BufferData associated with |buffer|. NULL if no data is |
| 30 // associated. |
| 31 static BufferData* GetData(gbm_bo* buffer); |
| 32 |
| 33 uint32_t framebuffer() const { return framebuffer_; } |
| 34 uint32_t handle() const { return handle_; } |
| 35 |
| 36 private: |
| 37 BufferData(DriWrapper* dri, gbm_bo* buffer); |
| 38 ~BufferData(); |
| 39 |
| 40 DriWrapper* dri_; |
| 41 |
| 42 uint32_t handle_; |
| 43 |
| 44 // ID provided by the controller when the buffer is registered. This ID is |
| 45 // used when scanning out the buffer. |
| 46 uint32_t framebuffer_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(BufferData); |
| 49 }; |
| 50 |
| 51 } // namespace ui |
| 52 |
| 53 #endif // UI_OZONE_PLATFORM_DRI_BUFFER_DATA_H_ |
OLD | NEW |