Debian Codegraph @

xbmc/windowing/gbm/drm/DRMCrtc.cpp

raw
1 /*
2 * Copyright (C) 2005-2020 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 #include "DRMCrtc.h"
10
11 #include <cstring>
12 #include <errno.h>
13 #include <stdexcept>
14 #include <string>
15
16 using namespace KODI::WINDOWING::GBM;
17
18 CDRMCrtc::CDRMCrtc(int fd, uint32_t crtc) : CDRMObject(fd), m_crtc(drmModeGetCrtc(m_fd, crtc))
19 {
20 if (!m_crtc)
21 throw std::runtime_error("drmModeGetCrtc failed: " + std::string{strerror(errno)});
22
23 if (!GetProperties(m_crtc->crtc_id, DRM_MODE_OBJECT_CRTC))
24 throw std::runtime_error("failed to get properties for crtc: " +
25 std::to_string(m_crtc->crtc_id));
26 }