20 #include "../exception.h"
26 #include <xf86drmMode.h>
50 device = open(path, O_RDWR | O_CLOEXEC);
52 throw DRMError(std::string(
"Cannot open DRM device") + path);
68 operator bool()
const {
84 throw DRMError(
"Cannot get DRM resources");
105 for (
int i = 0; i < resPtr->count_connectors; ++i) {
107 if (
connector->connection == DRM_MODE_CONNECTED)
111 throw DRMError(
"Cannot get DRM connector");
121 other.connector =
nullptr;
141 throw DRMError(
"Cannot get DRM encoder");
152 other.encoder =
nullptr;
173 crtc(drmModeGetCrtc(this->
device, encoder.getPointer()->crtc_id))
176 throw DRMError(
"Cannot get DRM crtc");
182 drmModeFreeCrtc(
crtc);
190 other.crtc =
nullptr;
206 throw DRMError(
"Cannot get GBM device");
211 gbm_device_destroy(
device);
216 other.device =
nullptr;
231 static const int FORMAT = GBM_FORMAT_XRGB8888;
243 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING
246 throw DRMError(
"Cannot create GBM surface");
256 other.surface =
nullptr;
DRMError(const std::string &info)
Device(const Device &)=delete
Device & operator=(Device &&other)
struct gbm_device * getPointer()
struct gbm_device * device
GBMDevice(const GBMDevice &)=delete
GBMDevice & operator=(GBMDevice &&other)
GBMDevice(Device &driDevice, ModeConnector &connector)
GBMSurface(const GBMSurface &)=delete
GBMSurface(GBMDevice &gbmDevice, const ModeConnector &connector)
GBMSurface & operator=(GBMSurface &&other)
struct gbm_surface * surface
struct gbm_surface * getPointer()
const drmModeModeInfo & getMode(int index) const
ModeConnector(const ModeConnector &)=delete
ModeConnector(Device &device, ModeResources &resources)
drmModeConnector * getPointer()
drmModeConnector * connector
ModeConnector & operator=(ModeConnector &&other)
ModeCrtc & operator=(ModeCrtc &&other)
ModeCrtc(Device &device, ModeEncoder &encoder, ModeConnector &connector)
ModeCrtc(const ModeCrtc &)=delete
ModeEncoder(const ModeEncoder &)=delete
ModeEncoder & operator=(ModeEncoder &&other)
ModeEncoder(Device &device, ModeConnector &connector)
drmModeEncoder * getPointer()
ModeResources(Device &device)
ModeResources(const ModeResources &)=delete
drmModeRes * getPointer()
Base class for all exceptions.