summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-21 14:36:31 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-27 11:27:10 -0700
commitf579f7e654be0792294a299a32cc0d6f80d74e7e (patch)
tree4708ae3fc2050169538b91aded7fe42380ed72bf
parent998281c7a865da06d9c6fb832484a20d9f9e5e21 (diff)
Present: add per-crtc capabilities to -ext outputHEADmaster
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xdpyinfo/-/merge_requests/13>
-rw-r--r--configure.ac2
-rw-r--r--xdpyinfo.c26
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>])
diff --git a/xdpyinfo.c b/xdpyinfo.c
index c1173f4..3e3caf1 100644
--- a/xdpyinfo.c
+++ b/xdpyinfo.c
@@ -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;