diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 48ab560747993b187e64042ac91c88bf46733316..30f3abff0d41c8cf1c71e950afb39fea70a6729b 100644 (file)
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
{
Card::Card()
+ : Card("/dev/dri/card0")
{
- const char *card = "/dev/dri/card0";
+}
+
- int fd = open(card, O_RDWR | O_CLOEXEC);
+Card::Card(const std::string& device)
+{
+ int fd = open(device.c_str(), O_RDWR | O_CLOEXEC);
if (fd < 0)
- throw invalid_argument(string(strerror(errno)) + " opening " +
- card);
+ throw invalid_argument(string(strerror(errno)) + " opening " + device);
m_fd = fd;
int r;
for (int i = 0; i < res->count_encoders; ++i) {
uint32_t id = res->encoders[i];
- auto ob = new Encoder(*this, id);
+ auto ob = new Encoder(*this, id, i);
m_obmap[id] = ob;
m_encoders.push_back(ob);
}
for (uint i = 0; i < planeRes->count_planes; ++i) {
uint32_t id = planeRes->planes[i];
- auto ob = new Plane(*this, id);
+ auto ob = new Plane(*this, id, i);
m_obmap[id] = ob;
m_planes.push_back(ob);
}
close(m_fd);
}
+void Card::drop_master()
+{
+ drmDropMaster(fd());
+}
+
void Card::restore_modes()
{
for (auto conn : get_connectors())