Filter out cursors from drm planes
This commit is contained in:
@@ -103,10 +103,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(drmSetClientCap(fd.el, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
|
if(drmSetClientCap(fd.el, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
|
||||||
BOOST_LOG(error) << "Couldn't expose some/all drm planes"sv;
|
BOOST_LOG(error) << "Couldn't expose some/all drm planes for card: "sv << path;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(drmSetClientCap(fd.el, DRM_CLIENT_CAP_ATOMIC, 1)) {
|
||||||
|
BOOST_LOG(warning) << "Couldn't expose some properties for card: "sv << path;
|
||||||
|
}
|
||||||
|
|
||||||
plane_res.reset(drmModeGetPlaneResources(fd.el));
|
plane_res.reset(drmModeGetPlaneResources(fd.el));
|
||||||
if(!plane_res) {
|
if(!plane_res) {
|
||||||
BOOST_LOG(error) << "Couldn't get drm plane resources"sv;
|
BOOST_LOG(error) << "Couldn't get drm plane resources"sv;
|
||||||
@@ -257,6 +261,24 @@ public:
|
|||||||
|
|
||||||
auto end = std::end(card);
|
auto end = std::end(card);
|
||||||
for(auto plane = std::begin(card); plane != end; ++plane) {
|
for(auto plane = std::begin(card); plane != end; ++plane) {
|
||||||
|
bool cursor;
|
||||||
|
auto props = card.plane_props(plane->plane_id);
|
||||||
|
for(auto &[prop, val] : props) {
|
||||||
|
if(prop->name == "type"sv) {
|
||||||
|
BOOST_LOG(verbose) << prop->name << "::"sv << kms::plane_type(val);
|
||||||
|
|
||||||
|
if(val == DRM_PLANE_TYPE_CURSOR) {
|
||||||
|
// Don't count as a monitor when it is a cursor
|
||||||
|
cursor = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cursor) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(monitor != monitor_index) {
|
if(monitor != monitor_index) {
|
||||||
++monitor;
|
++monitor;
|
||||||
continue;
|
continue;
|
||||||
@@ -581,12 +603,17 @@ std::vector<std::string> kms_display_names() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cursor = false;
|
||||||
{
|
{
|
||||||
BOOST_LOG(verbose) << "PLANE INFO"sv;
|
BOOST_LOG(verbose) << "PLANE INFO ["sv << count << ']';
|
||||||
auto props = card.plane_props(card.plane_res->planes[count]);
|
auto props = card.plane_props(plane->plane_id);
|
||||||
for(auto &[prop, val] : props) {
|
for(auto &[prop, val] : props) {
|
||||||
if(prop->name == "type"sv) {
|
if(prop->name == "type"sv) {
|
||||||
BOOST_LOG(verbose) << prop->name << "::"sv << kms::plane_type(val);
|
BOOST_LOG(verbose) << prop->name << "::"sv << kms::plane_type(val);
|
||||||
|
|
||||||
|
if(val == DRM_PLANE_TYPE_CURSOR) {
|
||||||
|
cursor = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BOOST_LOG(verbose) << prop->name << "::"sv << val;
|
BOOST_LOG(verbose) << prop->name << "::"sv << val;
|
||||||
@@ -620,7 +647,9 @@ std::vector<std::string> kms_display_names() {
|
|||||||
|
|
||||||
kms::print(plane.get(), fb.get(), crtc.get());
|
kms::print(plane.get(), fb.get(), crtc.get());
|
||||||
|
|
||||||
display_names.emplace_back(std::to_string(count++));
|
if(!cursor) {
|
||||||
|
display_names.emplace_back(std::to_string(count++));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,22 +57,6 @@ _FN(Free, int, (void *data));
|
|||||||
_FN(InitThreads, Status, (void));
|
_FN(InitThreads, Status, (void));
|
||||||
|
|
||||||
namespace rr {
|
namespace rr {
|
||||||
using Mode = XID;
|
|
||||||
using Output = XID;
|
|
||||||
|
|
||||||
struct CrtcInfo {
|
|
||||||
Time timestamp;
|
|
||||||
int x, y;
|
|
||||||
unsigned int width, height;
|
|
||||||
Mode mode;
|
|
||||||
Rotation rotation;
|
|
||||||
int noutput;
|
|
||||||
Output *outputs;
|
|
||||||
Rotation rotations;
|
|
||||||
int npossible;
|
|
||||||
Output *possible;
|
|
||||||
};
|
|
||||||
|
|
||||||
_FN(GetScreenResources, XRRScreenResources *, (Display * dpy, Window window));
|
_FN(GetScreenResources, XRRScreenResources *, (Display * dpy, Window window));
|
||||||
_FN(GetOutputInfo, XRROutputInfo *, (Display * dpy, XRRScreenResources *resources, RROutput output));
|
_FN(GetOutputInfo, XRROutputInfo *, (Display * dpy, XRRScreenResources *resources, RROutput output));
|
||||||
_FN(GetCrtcInfo, XRRCrtcInfo *, (Display * dpy, XRRScreenResources *resources, RRCrtc crtc));
|
_FN(GetCrtcInfo, XRRCrtcInfo *, (Display * dpy, XRRScreenResources *resources, RRCrtc crtc));
|
||||||
|
|||||||
Reference in New Issue
Block a user