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.
5 #ifndef UI_OZONE_PLATFORM_DRI_BUFFER_DATA_H_
6 #define UI_OZONE_PLATFORM_DRI_BUFFER_DATA_H_
8 #include "base/memory/scoped_ptr.h"
16 // This class is used to tag a gbm buffer with custom information needed
17 // for presentation with the surface factory.
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);
26 // Callback used by GBM to destroy the BufferData associated with a buffer.
27 static void Destroy(gbm_bo* buffer, void* data);
29 // Returns the BufferData associated with |buffer|. NULL if no data is
31 static BufferData* GetData(gbm_bo* buffer);
33 uint32_t framebuffer() const { return framebuffer_; }
34 uint32_t handle() const { return handle_; }
37 BufferData(DriWrapper* dri, gbm_bo* buffer);
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_;
48 DISALLOW_COPY_AND_ASSIGN(BufferData);
53 #endif // UI_OZONE_PLATFORM_DRI_BUFFER_DATA_H_