diff options
Diffstat (limited to '')
| -rw-r--r-- | include/drm++/gem.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/drm++/gem.hpp b/include/drm++/gem.hpp index e3e3306..2873e7b 100644 --- a/include/drm++/gem.hpp +++ b/include/drm++/gem.hpp @@ -85,7 +85,9 @@ class ObjectManager { friend class Object; friend class DumbBuffer; public: + /// /// Create a new object manager. + /// ObjectManager(int fd) noexcept : m_fd(fd) {} // Convenience method to create a new objects @@ -112,21 +114,26 @@ private: class Object { friend class DumbBuffer; public: + /// /// Import a DMA-BUF file descriptor into a GEM object. /// Requires DRM_PRIME_CAP_IMPORT. /// /// An import can fail for various driver-specific reasons, especially for foreign DMA-BUFs. /// /// @param close Close fd after import (regardless of success) + /// Object(ObjectManager& manager, int dmabuf_fd, bool close = true); + /// /// Flags for exporting fds + /// enum class ExportFlags : u32 { None = 0, ReadWrite = 1 << 0, //!< Allow read/write access (drivers may ignore this) CloseOnExec = 1 << 1, //!< Close fd on execve() }; + /// /// Export a DMA-BUF file descriptor from the GEM object. /// Requires DRM_PRIME_CAP_EXPORT. /// @@ -134,11 +141,15 @@ public: /// specific GEM object. /// /// @param flags Flags to set on the exported file descriptor. + /// [[nodiscard]] int exportFd(ExportFlags flags = ExportFlags::None) const; + /// /// Change the handle of the GEM object. + /// /// @param handle An unused GEM handle to change into. /// @throws std::logic_error if the handle is still in use by another class instance. + /// void changeHandle(u32 handle); // Private access @@ -184,12 +195,17 @@ private: /// class DumbBuffer : public Object { public: + /// /// Create a new dumb buffer. + /// DumbBuffer(ObjectManager& manager, u32 width, u32 height, u32 bpp); + /// /// Map the dumb buffer into userspace memory. May be called multiple times, /// will return the same pointer if already mapped. + /// /// @throws std::system_error on mmap failure + /// [[nodiscard]] void* map(); // Private access |
