Skip to content

Commit

Permalink
Fix find_nv_x11 logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Etaash-mathamsetty committed Oct 12, 2024
1 parent e77ff17 commit f20ad23
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/nvidia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,19 @@ char* NVIDIA::get_attr_target_string(libnvctrl_loader& nvctrl, int attr, int tar
#if defined(HAVE_XNVCTRL) && defined(HAVE_X11)
bool NVIDIA::find_nv_x11(libnvctrl_loader& nvctrl, Display*& dpy)
{
char buf[8] {};
const char *display = getenv("DISPLAY");
auto libx11 = get_libx11();
Display *d = libx11->XOpenDisplay(getenv("DISPLAY"));
if (d) {
int s = libx11->XDefaultScreen(d);
if (nvctrl.XNVCTRLIsNvScreen(d, s)) {
dpy = d;
SPDLOG_DEBUG("XNVCtrl is using display {}", buf);
return true;
if(display) {
Display *d = libx11->XOpenDisplay(display);
if (d) {
int s = libx11->XDefaultScreen(d);
if (nvctrl.XNVCTRLIsNvScreen(d, s)) {
dpy = d;
SPDLOG_DEBUG("XNVCtrl is using display {}", display);
return true;
}
libx11->XCloseDisplay(d);
}
libx11->XCloseDisplay(d);
}
return false;
}
Expand Down

0 comments on commit f20ad23

Please sign in to comment.