/* * dgafbtest.c (ver 1.1) * * Test program for XFree86 DGA extension. * * COMPILE USING: * cc -o dgatest dgatest.c -I/usr/X11R6/include -L/usr/X11R6/lib \ * -lX11 -lXext -lXxf86dga * * (C) 2001 Randall Hopper * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. 2. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include #include #include /* req's Xlib.h */ int main() { Display *display; int dga_major_vers, dga_minor_vers, screen, dv_flags, width, bank_size, mem_size; char *addr; display = XOpenDisplay( NULL ); if ( display == NULL ) { fprintf( stderr, "XOpenDisplay() failed\n" ); exit(1); } screen = DefaultScreen( display ); printf( "XF86 DGA Extension\n\n" ); if ( !XF86DGAQueryVersion( display, &dga_major_vers, &dga_minor_vers ) ) { fprintf( stderr, "XF86DGAQueryVersion() failed\n" ); exit(1); } printf( "\tVersion = %d.%.2d\n", dga_major_vers, dga_minor_vers ); if ( !XF86DGAQueryDirectVideo( display, screen, &dv_flags ) ) { fprintf( stderr, "XF86DGAQueryDirectVideo() failed\n" ); exit(1); } printf( "\tDirect Video = " ); printf( "%s ", ( dv_flags & XF86DGADirectGraphics ) ? "DirectGraphics" : "NO-DirectGraphics" ); printf( "%s ", ( dv_flags & XF86DGADirectMouse ) ? "DirectMouse" : "NO-DirectMouse" ); printf( "%s ", ( dv_flags & XF86DGADirectKeyb ) ? "DirectKeyb" : "NO-DirectKeyb" ); printf( "\n" ); if ( !XF86DGAGetVideo( display, screen, &addr, &width, &bank_size, &mem_size ) ) { fprintf( stderr, "XF86DGAGetVideo() failed\n" ); exit(1); } printf( "\nXF86DGAGetVideo:\n" ); printf( "\tVideo Address = 0x%.8x\n", (int) addr ); printf( "\t Width = %d\n", width ); printf( "\t BankSize = %dK\n", bank_size/1024 ); printf( "\t MemSize = %dK\n", mem_size ); if ( !XF86DGAGetVideoLL( display, screen, (int*) &addr, &width, &bank_size, &mem_size ) ) { fprintf( stderr, "XF86DGAGetVideoLL() failed\n" ); exit(1); } printf( "\nXF86DGAGetVideoLL:\n" ); printf( "\tVideo Address = 0x%.8x\n", (int)addr ); printf( "\t Width = %d\n", width ); printf( "\t BankSize = %dK\n", bank_size/1024 ); printf( "\t MemSize = %dK\n", mem_size ); XCloseDisplay( display ); return 0; }