From: Pierre Ossman Date: Mon, 26 Jan 2015 14:15:47 +0000 (+0100) Subject: More debug logging for screen layout changes X-Git-Tag: v1.4.90~66^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F109%2Fhead;p=tigervnc.git More debug logging for screen layout changes --- diff --git a/common/rfb/ScreenSet.h b/common/rfb/ScreenSet.h index 8997aa64..ad340c2b 100644 --- a/common/rfb/ScreenSet.h +++ b/common/rfb/ScreenSet.h @@ -22,6 +22,7 @@ #define __RFB_SCREENSET_INCLUDED__ #include +#include #include #include @@ -108,15 +109,20 @@ namespace rfb { return true; }; - inline void debug_print(void) const { + inline void print(char* str, size_t len) const { + char buffer[128]; std::list::const_iterator iter; - fprintf(stderr, "%d screens\n", num_screens()); + snprintf(buffer, sizeof(buffer), "%d screen(s)\n", num_screens()); + str[0] = '\0'; + strncat(str, buffer, len - 1 - strlen(str)); for (iter = screens.begin();iter != screens.end();++iter) { - fprintf(stderr, " %10d (0x%08x): %dx%d+%d+%d (flags 0x%08x)\n", - (int)iter->id, (unsigned)iter->id, - iter->dimensions.width(), iter->dimensions.height(), - iter->dimensions.tl.x, iter->dimensions.tl.y, - (unsigned)iter->flags); + snprintf(buffer, sizeof(buffer), + " %10d (0x%08x): %dx%d+%d+%d (flags 0x%08x)\n", + (int)iter->id, (unsigned)iter->id, + iter->dimensions.width(), iter->dimensions.height(), + iter->dimensions.tl.x, iter->dimensions.tl.y, + (unsigned)iter->flags); + strncat(str, buffer, len - 1 - strlen(str)); } }; diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 3774b7f6..b8988131 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -653,6 +653,12 @@ unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height, if (vncRandRGetOutputCount(screenIndex) == 0) return rfb::resultProhibited; + char buffer[2048]; + vlog.debug("Got request for framebuffer resize to %dx%d", + fb_width, fb_height); + layout.print(buffer, sizeof(buffer)); + vlog.debug("%s", buffer); + /* * First check that we don't have any active clone modes. That's just * too messy to deal with. @@ -667,6 +673,8 @@ unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height, /* Try to create more outputs if needed... (only works on Xvnc) */ if (layout.num_screens() > availableOutputs) { + vlog.debug("Insufficient screens. Need to create %d more.", + layout.num_screens() - availableOutputs); ret = vncRandRCreateOutputs(screenIndex, layout.num_screens() - availableOutputs); if (ret < 0) { diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 423d2df3..e2046624 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -798,8 +798,11 @@ void DesktopWindow::remoteResize(int width, int height) (layout == cc->cp.screenLayout)) return; - vlog.debug("Requesting framebuffer resize from %dx%d to %dx%d (%d screens)", - cc->cp.width, cc->cp.height, width, height, layout.num_screens()); + char buffer[2048]; + vlog.debug("Requesting framebuffer resize from %dx%d to %dx%d", + cc->cp.width, cc->cp.height, width, height); + layout.print(buffer, sizeof(buffer)); + vlog.debug("%s", buffer); if (!layout.validate(width, height)) { vlog.error(_("Invalid screen layout computed for resize request!"));