diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | xdpyinfo.c | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index c3d3543..e4367d8 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ PKG_CHECK_MODULES(DPY_XTST, xtst, AC_CHECK_HEADERS([X11/extensions/record.h],,,[#include <X11/Xlib.h>]) CPPFLAGS="$SAVE_CPPFLAGS"],[echo "not found"]) -PKG_CHECK_MODULES(DPY_XPRESENT, xpresent, +PKG_CHECK_MODULES(DPY_XPRESENT, [xpresent xrandr >= 1.2], [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $DPY_XPRESENT_CFLAGS $DPY_X11_CFLAGS" AC_CHECK_HEADERS([X11/extensions/Xpresent.h],,,[#include <X11/Xlib.h>]) @@ -143,6 +143,7 @@ in this Software without prior written authorization from The Open Group. #endif #ifdef PRESENT #include <X11/extensions/Xpresent.h> +#include <X11/extensions/Xrandr.h> #endif #include <X11/Xos.h> #include <stdio.h> @@ -1423,12 +1424,22 @@ static int print_present_info(Display *dpy, const char *extname) { int opcode, event_base, error_base; int major_version, minor_version; + Bool query_crtcs = False; if (!XPresentQueryExtension(dpy, &opcode, &event_base, &error_base) || !XPresentQueryVersion(dpy, &major_version, &minor_version)) return 0; print_standard_extension_info(dpy, extname, major_version, minor_version); + if (XRRQueryExtension (dpy, &event_base, &error_base)) { + int rr_major, rr_minor; + + if (XRRQueryVersion (dpy, &rr_major, &rr_minor) && + (rr_major == 1) && (rr_minor >= 2)) { + query_crtcs = True; + } + } + for (int i = 0; i < ScreenCount (dpy); i++) { Window screen_root = RootWindow(dpy, i); uint32_t capabilities = XPresentQueryCapabilities(dpy, screen_root); @@ -1436,6 +1447,21 @@ static int print_present_info(Display *dpy, const char *extname) printf(" screen #%d capabilities: 0x%x (", i, capabilities); print_present_capabilities(capabilities); puts(")"); + + if (query_crtcs) { + XRRScreenResources *res = XRRGetScreenResources (dpy, screen_root); + + if (res != NULL) { + for (int c = 0; c < res->ncrtc; c++) { + capabilities = XPresentQueryCapabilities(dpy, res->crtcs[c]); + printf(" crtc 0x%lx capabilities: 0x%x (", + res->crtcs[c], capabilities); + print_present_capabilities(capabilities); + puts(")"); + } + XRRFreeScreenResources(res); + } + } } return 1; |