diff options
-rw-r--r-- | kms++/src/card.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp index 5d6a597..3b3e2c1 100644 --- a/kms++/src/card.cpp +++ b/kms++/src/card.cpp @@ -147,43 +147,43 @@ void Card::setup() throw invalid_argument("Dumb buffers not available"); auto res = drmModeGetResources(m_fd); - if (!res) - throw invalid_argument("Can't get card resources"); - - for (int i = 0; i < res->count_connectors; ++i) { - uint32_t id = res->connectors[i]; - auto ob = new Connector(*this, id, i); - m_obmap[id] = ob; - m_connectors.push_back(ob); - } + if (res) { + for (int i = 0; i < res->count_connectors; ++i) { + uint32_t id = res->connectors[i]; + auto ob = new Connector(*this, id, i); + m_obmap[id] = ob; + m_connectors.push_back(ob); + } - for (int i = 0; i < res->count_crtcs; ++i) { - uint32_t id = res->crtcs[i]; - auto ob = new Crtc(*this, id, i); - m_obmap[id] = ob; - m_crtcs.push_back(ob); - } + for (int i = 0; i < res->count_crtcs; ++i) { + uint32_t id = res->crtcs[i]; + auto ob = new Crtc(*this, id, i); + m_obmap[id] = ob; + m_crtcs.push_back(ob); + } - for (int i = 0; i < res->count_encoders; ++i) { - uint32_t id = res->encoders[i]; - auto ob = new Encoder(*this, id, i); - m_obmap[id] = ob; - m_encoders.push_back(ob); - } + for (int i = 0; i < res->count_encoders; ++i) { + uint32_t id = res->encoders[i]; + auto ob = new Encoder(*this, id, i); + m_obmap[id] = ob; + m_encoders.push_back(ob); + } - drmModeFreeResources(res); + drmModeFreeResources(res); - auto planeRes = drmModeGetPlaneResources(m_fd); + auto planeRes = drmModeGetPlaneResources(m_fd); + if (planeRes) { + for (uint i = 0; i < planeRes->count_planes; ++i) { + uint32_t id = planeRes->planes[i]; + auto ob = new Plane(*this, id, i); + m_obmap[id] = ob; + m_planes.push_back(ob); + } - for (uint i = 0; i < planeRes->count_planes; ++i) { - uint32_t id = planeRes->planes[i]; - auto ob = new Plane(*this, id, i); - m_obmap[id] = ob; - m_planes.push_back(ob); + drmModeFreePlaneResources(planeRes); + } } - drmModeFreePlaneResources(planeRes); - // collect all possible props for (auto ob : get_objects()) { auto props = drmModeObjectGetProperties(m_fd, ob->id(), ob->object_type()); |