From f05d97543de36a6e3e6e7a74547c54d259e7b082 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Thu, 27 Apr 2006 14:14:54 -0700 Subject: [PATCH] Add test program for XFree86-DRI extension to xcb-demo. Mark XFree86-DRI extension as tested and working. --- Makefile.am | 6 +++++- configure.ac | 1 + xcbxf86dri.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 xcbxf86dri.c diff --git a/Makefile.am b/Makefile.am index 67b6a44..21793ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = autogen.sh README INCLUDES = $(XCB_CFLAGS) LDADD = $(XCB_LIBS) -bin_PROGRAMS = hypnomoire xdpyinfo xcb-test dpms rendertest xcbrandr +bin_PROGRAMS = hypnomoire xdpyinfo xcb-test dpms rendertest xcbrandr xcbxf86dri hypnomoire_CFLAGS = $(XCBAUX_CFLAGS) hypnomoire_LDADD = $(XCBAUX_LIBS) -lm -lpthread @@ -31,3 +31,7 @@ rendertest_SOURCES = rendertest.c xcbrandr_CFLAGS = $(XCBAUX_CFLAGS) $(XCBRANDR_CFLAGS) xcbrandr_LDADD = $(XCBAUX_LIBS) $(XCBRANDR_LIBS) xcbrandr_SOURCES = xcbrandr.c + +xcbxf86dri_CFLAGS = $(XCBXF86DRI_CFLAGS) +xcbxf86dri_LDADD = $(XCBXF86DRI_LIBS) +xcbxf86dri_SOURCES = xcbxf86dri.c diff --git a/configure.ac b/configure.ac index 35f9584..d989498 100644 --- a/configure.ac +++ b/configure.ac @@ -17,5 +17,6 @@ PKG_CHECK_MODULES(XCBICCCM, xcb-icccm) PKG_CHECK_MODULES(XCBDPMS, xcb-dpms) PKG_CHECK_MODULES(XCBRENDER, xcb-render) PKG_CHECK_MODULES(XCBRANDR, xcb-randr) +PKG_CHECK_MODULES(XCBXF86DRI, xcb-xf86dri) AC_OUTPUT([Makefile tests/Makefile]) diff --git a/xcbxf86dri.c b/xcbxf86dri.c new file mode 100644 index 0000000..e471431 --- /dev/null +++ b/xcbxf86dri.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2006 Josh Triplett. All Rights Reserved. See the file + * COPYING in this directory for licensing information. */ +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + int screen; + XCBXF86DriQueryVersionCookie qvc; + XCBXF86DriQueryVersionRep *qv; + XCBXF86DriQueryDirectRenderingCapableCookie qdrc; + XCBXF86DriQueryDirectRenderingCapableRep *qdr; + XCBConnection *c = XCBConnect(NULL, &screen); + + if(!c) + { + fprintf(stderr, "Error establishing connection to X server."); + return 1; + } + + qvc = XCBXF86DriQueryVersion(c); + qdrc = XCBXF86DriQueryDirectRenderingCapable(c, screen); + + qv = XCBXF86DriQueryVersionReply(c, qvc, 0); + if(!qv) + { + fprintf(stderr, "Error querying DRI extension version.\n"); + return 1; + } + printf("DRI extension version: %hu.%hu.%u\n", + qv->dri_major_version, qv->dri_minor_version, qv->dri_minor_patch); + free(qv); + + qdr = XCBXF86DriQueryDirectRenderingCapableReply(c, qdrc, 0); + if(!qdr) + { + fprintf(stderr, "Error querying direct rendering capability.\n"); + return 1; + } + printf("Direct rendering (screen %d): %s\n", + screen, qdr->is_capable ? "yes" : "no"); + free(qdr); + + XCBDisconnect(c); + + return 0; +} -- 2.34.1