Skip to content

Commit

Permalink
Add log messages to indicate display numbers for KMS and Wlgrab
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Mar 2, 2024
1 parent 75a9788 commit 1ab30aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/platform/linux/kmsgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,13 @@ namespace platf {
};

struct monitor_t {
// Connector attributes
std::uint32_t type;

std::uint32_t index;

// Monitor index in the global list
std::uint32_t monitor_index;

platf::touch_port_t viewport;
};

Expand Down Expand Up @@ -1516,11 +1519,11 @@ namespace platf {
correlate_to_wayland(std::vector<kms::card_descriptor_t> &cds) {
auto monitors = wl::monitors();

BOOST_LOG(info) << "-------- Start of KMS monitor list --------"sv;

for (auto &monitor : monitors) {
std::string_view name = monitor->name;

BOOST_LOG(info) << name << ": "sv << monitor->description;

// Try to convert names in the format:
// {type}-{index}
// {index} is n'th occurrence of {type}
Expand Down Expand Up @@ -1553,6 +1556,7 @@ namespace platf {
<< monitor->viewport.width << 'x' << monitor->viewport.height;
}

BOOST_LOG(info) << "Monitor " << monitor_descriptor.monitor_index << " is "sv << name << ": "sv << monitor->description;
goto break_for_loop;
}
}
Expand All @@ -1561,6 +1565,8 @@ namespace platf {

BOOST_LOG(verbose) << "Reduced to name: "sv << name << ": "sv << index;
}

BOOST_LOG(info) << "--------- End of KMS monitor list ---------"sv;
}

// A list of names of displays accepted as display_name
Expand Down Expand Up @@ -1637,6 +1643,7 @@ namespace platf {
(int) crtc->width,
(int) crtc->height,
};
it->second.monitor_index = count;
}

kms::env_width = std::max(kms::env_width, (int) (crtc->x + crtc->width));
Expand Down
6 changes: 6 additions & 0 deletions src/platform/linux/wlgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,21 @@ namespace platf {

display.roundtrip();

BOOST_LOG(info) << "-------- Start of Wayland monitor list --------"sv;

for (int x = 0; x < interface.monitors.size(); ++x) {
auto monitor = interface.monitors[x].get();

wl::env_width = std::max(wl::env_width, (int) (monitor->viewport.offset_x + monitor->viewport.width));
wl::env_height = std::max(wl::env_height, (int) (monitor->viewport.offset_y + monitor->viewport.height));

BOOST_LOG(info) << "Monitor " << x << " is "sv << monitor->name << ": "sv << monitor->description;

display_names.emplace_back(std::to_string(x));
}

BOOST_LOG(info) << "--------- End of Wayland monitor list ---------"sv;

return display_names;
}

Expand Down

0 comments on commit 1ab30aa

Please sign in to comment.