/*1* Copyright © 2020 Collabora, Ltd.2* Author: Antonio Caggiano <[email protected]>3* Author: Rohan Garg <[email protected]>4* Author: Robert Beckett <[email protected]>5*6* SPDX-License-Identifier: MIT7*/89#pragma once1011#include <optional>12#include <string>13#include <vector>1415namespace pps16{17/// @brief Helper class for a DRM device18class DrmDevice19{20public:21/// @return The number of DRM devices available in the system22static uint32_t device_count();2324/// @return All DRM devices available in the system25static std::vector<DrmDevice> create_all();2627/// @return A DRM device selected by its number in the system, nullopt otherwise28static std::optional<DrmDevice> create(int32_t gpu_num);2930/// @brief Prefer calling create instead of default constructor31DrmDevice() = default;3233// Allow move34DrmDevice(DrmDevice &&);35DrmDevice &operator=(DrmDevice &&);3637// Forbid copy38DrmDevice(const DrmDevice &) = delete;39DrmDevice &operator=(const DrmDevice &) = delete;4041~DrmDevice();4243/// @return Whether a device has a valid name44operator bool() const;4546/// File descriptor of the device opened in read/write mode47int fd = -1;48int32_t gpu_num = -1;49std::string name = "";50};5152} // namespace pps535455