xbmc
GBMBufferObject.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "utils/BufferObject.h"
12 
13 #include <memory>
14 #include <stdint.h>
15 
16 struct gbm_bo;
17 struct gbm_device;
18 
20 {
21 public:
23  ~CGBMBufferObject() override;
24 
25  // Registration
26  static std::unique_ptr<CBufferObject> Create();
27  static void Register();
28 
29  // IBufferObject overrides via CBufferObject
30  bool CreateBufferObject(uint32_t format, uint32_t width, uint32_t height) override;
31  void DestroyBufferObject() override;
32  uint8_t* GetMemory() override;
33  void ReleaseMemory() override;
34  std::string GetName() const override { return "CGBMBufferObject"; }
35 
36  // CBufferObject overrides
37  uint64_t GetModifier() override;
38 
39 private:
40  gbm_device* m_device{nullptr};
41  gbm_bo* m_bo{nullptr};
42 
43  uint32_t m_width{0};
44  uint32_t m_height{0};
45 
46  uint8_t* m_map{nullptr};
47  void* m_map_data{nullptr};
48 };
std::string GetName() const override
Get the Name of the BufferObject type in use.
Definition: GBMBufferObject.h:34
bool CreateBufferObject(uint32_t format, uint32_t width, uint32_t height) override
Create a BufferObject based on the format, width, and height of the desired buffer.
Definition: GBMBufferObject.cpp:42
void ReleaseMemory() override
Release the mapped memory of the BufferObject.
Definition: GBMBufferObject.cpp:83
void DestroyBufferObject() override
Destroy a BufferObject.
Definition: GBMBufferObject.cpp:60
base class for using the IBufferObject interface.
Definition: BufferObject.h:21
uint64_t GetModifier() override
Get the Modifier of the BufferObject.
Definition: GBMBufferObject.cpp:93
Definition: GBMBufferObject.h:19
uint8_t * GetMemory() override
Get the Memory location of the BufferObject.
Definition: GBMBufferObject.cpp:71