x11perf.h revision 736a7e2c
1/***************************************************************************** 2Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. 3 4 All Rights Reserved 5 6Permission to use, copy, modify, and distribute this software and its 7documentation for any purpose and without fee is hereby granted, 8provided that the above copyright notice appear in all copies and that 9both that copyright notice and this permission notice appear in 10supporting documentation, and that the name of Digital not be 11used in advertising or publicity pertaining to distribution of the 12software without specific, written prior permission. 13 14DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20SOFTWARE. 21 22******************************************************************************/ 23 24#if HAVE_CONFIG_H 25#include "config.h" 26#endif 27 28#ifndef VMS 29#include <X11/Xlib.h> 30#include <stdlib.h> 31#include <X11/Xutil.h> 32#else 33#include <decw$include/Xlib.h> 34#include <decw$include/Xutil.h> 35#endif 36#if defined(XlibSpecificationRelease) && XlibSpecificationRelease >= 5 37#include <X11/Xfuncs.h> 38#endif 39#include <stddef.h> 40#include <X11/extensions/Xrender.h> 41 42#define POLY 1000 /* # (small) items in poly calls */ 43#define MAXROWS 40 /* Max rows of items in poly calls */ 44#define MAXCOLS 25 /* Max columns of items */ 45 46#define WIDTH 600 /* Size of large window to work within */ 47#define HEIGHT 600 48 49#define CHILDSIZE 8 /* Size of children on windowing tests */ 50#define CHILDSPACE 4 /* Space between children */ 51 52#define BigTile ((char *)2) /* Big tile/stipple */ 53#define OddTile ((char *)1) /* Odd sized tile/stipple */ 54 55#define PictStandardNative 5 56 57typedef unsigned char Version; 58 59#define VERSION1_2 ((Version)(1 << 0)) 60#define VERSION1_3 ((Version)(1 << 1)) 61#define VERSION1_4 ((Version)(1 << 2)) 62#define VERSION1_5 ((Version)(1 << 3)) 63#define VERSION1_6 ((Version)(1 << 4)) 64#define V1_2ONLY VERSION1_2 65#define V1_2FEATURE (VERSION1_2 | VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6) 66#define V1_3FEATURE (VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6) 67#define V1_4FEATURE (VERSION1_4 | VERSION1_5 | VERSION1_6) 68#define V1_5FEATURE (VERSION1_5 | VERSION1_6) 69#define V1_6FEATURE (VERSION1_6) 70 71typedef struct _Parms { 72 /* Required fields */ 73 int objects; /* Number of objects to process in one X call */ 74 75 /* Optional fields. (Wouldn't object-oriented programming be nice ?) */ 76 int special; /* Usually size of objects to paint */ 77 char *font, *bfont; 78 int fillStyle; /* Solid, transparent stipple, opaque stipple, tile */ 79} ParmRec, *Parms; 80 81typedef struct _XParms { 82 Display *d; 83 Window w; 84 Pixmap p; 85 GC fggc; 86 GC bggc; 87 GC ddfggc; 88 GC ddbggc; 89 Picture w_picture; 90 Picture p_picture; 91 unsigned long foreground; 92 unsigned long background; 93 unsigned long ddbackground; 94 XVisualInfo vinfo; 95 Bool pack; 96 Version version; 97 Bool save_under; 98 int backing_store; 99 unsigned long planemask; 100 int func; 101 int format; 102 Colormap cmap; 103} XParmRec, *XParms; 104 105typedef int (*InitProc)(XParms xp, Parms p, int reps); 106typedef void (*Proc)(XParms xp, Parms p, int reps); 107typedef void (*CleanupProc)(XParms xp, Parms p); 108 109typedef enum { 110 WINDOW, /* Windowing test, rop, planemask have no affect */ 111 ROP, /* Graphics test, rop, planemask has some affect */ 112 PLANEMASK, /* Graphics test, rop no affect, planemask some affect */ 113 NONROP, /* Graphics or overhead test, rop has no affect */ 114 COMP /* Graphics test, render op */ 115} TestType; 116 117typedef struct _Test { 118 char *option; /* Name to use in prompt line */ 119 char *label; /* Fuller description of test */ 120 char *label14; /* Labels that are different in Version 1.4 */ 121 InitProc init; /* Initialization procedure */ 122 Proc proc; /* Timed benchmark procedure */ 123 CleanupProc passCleanup;/* Cleanup between repetitions of same test */ 124 CleanupProc cleanup; /* Cleanup after test */ 125 Version versions; /* Test in 1.2 only, 1.3 only, or both */ 126 TestType testType; /* Windowing, graphics rop, graphics non-rop */ 127 int clips; /* Number of obscuring windows to force clipping*/ 128 ParmRec parms; /* Parameters passed to test procedures */ 129} Test; 130 131extern void NullProc(XParms xp, Parms p); 132extern int NullInitProc(XParms xp, Parms p, int reps); 133 134extern Test test[]; 135 136extern int abortTest; 137 138extern void AbortTest (void); 139 140#define CheckAbort() if (abortTest) AbortTest () 141#define ForEachTest(x) for (x = 0; test[x].option != NULL; x++) 142 143 144/* do_arcs.c */ 145extern int InitCircles ( XParms xp, Parms p, int reps ); 146extern int InitPartCircles ( XParms xp, Parms p, int reps ); 147extern int InitChordPartCircles ( XParms xp, Parms p, int reps ); 148extern int InitSlicePartCircles ( XParms xp, Parms p, int reps ); 149extern int InitWideCircles ( XParms xp, Parms p, int reps ); 150extern int InitPartWideCircles ( XParms xp, Parms p, int reps ); 151extern int InitDashedCircles ( XParms xp, Parms p, int reps ); 152extern int InitWideDashedCircles ( XParms xp, Parms p, int reps ); 153extern int InitDoubleDashedCircles ( XParms xp, Parms p, int reps ); 154extern int InitWideDoubleDashedCircles ( XParms xp, Parms p, int reps ); 155extern int InitEllipses ( XParms xp, Parms p, int reps ); 156extern int InitPartEllipses ( XParms xp, Parms p, int reps ); 157extern int InitChordPartEllipses ( XParms xp, Parms p, int reps ); 158extern int InitSlicePartEllipses ( XParms xp, Parms p, int reps ); 159extern int InitWideEllipses ( XParms xp, Parms p, int reps ); 160extern int InitPartWideEllipses ( XParms xp, Parms p, int reps ); 161extern int InitDashedEllipses ( XParms xp, Parms p, int reps ); 162extern int InitWideDashedEllipses ( XParms xp, Parms p, int reps ); 163extern int InitDoubleDashedEllipses ( XParms xp, Parms p, int reps ); 164extern int InitWideDoubleDashedEllipses ( XParms xp, Parms p, int reps ); 165extern void DoArcs ( XParms xp, Parms p, int reps ); 166extern void DoFilledArcs ( XParms xp, Parms p, int reps ); 167extern void EndArcs ( XParms xp, Parms p ); 168 169/* do_blt.c */ 170extern int InitScroll ( XParms xp, Parms p, int reps ); 171extern void DoScroll ( XParms xp, Parms p, int reps ); 172extern void MidScroll ( XParms xp, Parms p ); 173extern void EndScroll ( XParms xp, Parms p ); 174extern int InitCopyWin ( XParms xp, Parms p, int reps ); 175extern int InitCopyPix ( XParms xp, Parms p, int reps ); 176extern int InitGetImage ( XParms xp, Parms p, int reps ); 177extern int InitPutImage ( XParms xp, Parms p, int reps ); 178extern void DoCopyWinWin ( XParms xp, Parms p, int reps ); 179extern void DoCopyPixWin ( XParms xp, Parms p, int reps ); 180extern void DoCopyWinPix ( XParms xp, Parms p, int reps ); 181extern void DoCopyPixPix ( XParms xp, Parms p, int reps ); 182extern void DoGetImage ( XParms xp, Parms p, int reps ); 183extern void DoPutImage ( XParms xp, Parms p, int reps ); 184#ifdef MITSHM 185extern int InitShmPutImage ( XParms xp, Parms p, int reps ); 186extern void DoShmPutImage ( XParms xp, Parms p, int reps ); 187extern void EndShmPutImage ( XParms xp, Parms p ); 188#endif 189extern void MidCopyPix ( XParms xp, Parms p ); 190extern void EndCopyWin ( XParms xp, Parms p ); 191extern void EndCopyPix ( XParms xp, Parms p ); 192extern void EndGetImage ( XParms xp, Parms p ); 193extern int InitCopyPlane ( XParms xp, Parms p, int reps ); 194extern void DoCopyPlane ( XParms xp, Parms p, int reps ); 195 196int 197InitCompositeWin(XParms xp, Parms p, int reps); 198 199void 200EndCompositeWin (XParms xp, Parms p); 201 202void 203DoCompositeWinWin (XParms xp, Parms p, int reps); 204 205int 206InitCompositePix(XParms xp, Parms p, int reps); 207 208void 209EndCompositePix (XParms xp, Parms p); 210 211void 212DoCompositePixWin (XParms xp, Parms p, int reps); 213 214/* do_complex.c */ 215extern int InitComplexPoly ( XParms xp, Parms p, int reps ); 216extern void DoComplexPoly ( XParms xp, Parms p, int reps ); 217extern void EndComplexPoly ( XParms xp, Parms p ); 218extern int InitGeneralPoly ( XParms xp, Parms p, int reps ); 219extern void DoGeneralPoly ( XParms xp, Parms p, int reps ); 220 221/* do_dots.c */ 222extern int InitDots ( XParms xp, Parms p, int reps ); 223extern void DoDots ( XParms xp, Parms p, int reps ); 224extern void EndDots ( XParms xp, Parms p ); 225 226/* do_lines.c */ 227extern int InitLines ( XParms xp, Parms p, int reps ); 228extern int InitWideLines ( XParms xp, Parms p, int reps ); 229extern int InitDashedLines ( XParms xp, Parms p, int reps ); 230extern int InitWideDashedLines ( XParms xp, Parms p, int reps ); 231extern int InitDoubleDashedLines ( XParms xp, Parms p, int reps ); 232extern int InitWideDoubleDashedLines ( XParms xp, Parms p, int reps ); 233extern void DoLines ( XParms xp, Parms p, int reps ); 234extern void EndLines ( XParms xp, Parms p ); 235 236/* do_movewin.c */ 237extern int InitMoveWindows ( XParms xp, Parms p, int reps ); 238extern void DoMoveWindows ( XParms xp, Parms p, int reps ); 239extern void EndMoveWindows ( XParms xp, Parms p ); 240extern void DoResizeWindows ( XParms xp, Parms p, int reps ); 241extern int InitCircWindows ( XParms xp, Parms p, int reps ); 242extern void DoCircWindows ( XParms xp, Parms p, int reps ); 243extern void EndCircWindows ( XParms xp, Parms p ); 244extern int InitMoveTree ( XParms xp, Parms p, int reps ); 245extern void DoMoveTree ( XParms xp, Parms p, int reps ); 246extern void EndMoveTree ( XParms xp, Parms p ); 247 248/* do_rects.c */ 249extern int InitRectangles ( XParms xp, Parms p, int reps ); 250extern void DoRectangles ( XParms xp, Parms p, int reps ); 251extern void DoOutlineRectangles ( XParms xp, Parms p, int reps ); 252extern void EndRectangles ( XParms xp, Parms p ); 253 254/* do_segs.c */ 255extern int InitSegments ( XParms xp, Parms p, int reps ); 256extern int InitDashedSegments ( XParms xp, Parms p, int reps ); 257extern int InitDoubleDashedSegments ( XParms xp, Parms p, int reps ); 258extern int InitHorizSegments ( XParms xp, Parms p, int reps ); 259extern int InitWideHorizSegments ( XParms xp, Parms p, int reps ); 260extern int InitVertSegments ( XParms xp, Parms p, int reps ); 261extern int InitWideVertSegments ( XParms xp, Parms p, int reps ); 262extern void DoSegments ( XParms xp, Parms p, int reps ); 263extern void EndSegments ( XParms xp, Parms p ); 264 265/* do_simple.c */ 266extern void DoNoOp ( XParms xp, Parms p, int reps ); 267extern void DoGetAtom ( XParms xp, Parms p, int reps ); 268extern void DoQueryPointer ( XParms xp, Parms p, int reps ); 269extern int InitGetProperty ( XParms xp, Parms p, int reps ); 270extern void DoGetProperty ( XParms xp, Parms p, int reps ); 271 272/* do_text.c */ 273extern int InitText ( XParms xp, Parms p, int reps ); 274extern int InitText16 ( XParms xp, Parms p, int reps ); 275extern void DoText ( XParms xp, Parms p, int reps ); 276extern void DoText16 ( XParms xp, Parms p, int reps ); 277extern void DoPolyText ( XParms xp, Parms p, int reps ); 278extern void DoPolyText16 ( XParms xp, Parms p, int reps ); 279extern void DoImageText ( XParms xp, Parms p, int reps ); 280extern void DoImageText16 ( XParms xp, Parms p, int reps ); 281extern void ClearTextWin ( XParms xp, Parms p ); 282extern void EndText ( XParms xp, Parms p ); 283extern void EndText16 ( XParms xp, Parms p ); 284#ifdef XFT 285extern int InitAAText (XParms xp, Parms p, int reps ); 286extern void DoAAText (XParms xp, Parms p, int reps ); 287extern void EndAAText ( XParms xp, Parms p ); 288#endif 289 290/* do_traps.c */ 291extern int InitTrapezoids ( XParms xp, Parms p, int reps ); 292extern void DoTrapezoids ( XParms xp, Parms p, int reps ); 293extern void EndTrapezoids ( XParms xp, Parms p ); 294#if defined(XRENDER) && defined(XFT) 295extern int InitFixedTraps ( XParms xp, Parms p, int reps ); 296extern void DoFixedTraps ( XParms xp, Parms p, int reps ); 297extern void EndFixedTraps ( XParms xp, Parms p ); 298extern int InitFixedTrapezoids ( XParms xp, Parms p, int reps ); 299extern void DoFixedTrapezoids ( XParms xp, Parms p, int reps ); 300extern void EndFixedTrapezoids ( XParms xp, Parms p ); 301#endif 302 303/* do_tris.c */ 304extern int InitTriangles ( XParms xp, Parms p, int reps ); 305extern void DoTriangles ( XParms xp, Parms p, int reps ); 306extern void EndTriangles ( XParms xp, Parms p ); 307 308/* do_valgc.c */ 309extern int InitGC ( XParms xp, Parms p, int reps ); 310extern void DoChangeGC ( XParms xp, Parms p, int reps ); 311extern void EndGC ( XParms xp, Parms p ); 312 313/* do_windows.c */ 314extern int CreateParents ( XParms xp, Parms p, int reps ); 315extern void MapParents ( XParms xp, Parms p, int reps ); 316extern void MapParentsCleanup ( XParms xp, Parms p ); 317extern int InitCreate ( XParms xp, Parms p, int reps ); 318extern void CreateChildren ( XParms xp, Parms p, int reps ); 319extern void DestroyChildren ( XParms xp, Parms p ); 320extern void EndCreate ( XParms xp, Parms p ); 321extern int InitMap ( XParms xp, Parms p, int reps ); 322extern void UnmapParents ( XParms xp, Parms p, int reps ); 323extern void UnmapParentsCleanup ( XParms xp, Parms p); 324extern int InitDestroy ( XParms xp, Parms p, int reps ); 325extern void DestroyParents ( XParms xp, Parms p, int reps ); 326extern void RenewParents ( XParms xp, Parms p ); 327extern int InitPopups ( XParms xp, Parms p, int reps ); 328extern void DoPopUps ( XParms xp, Parms p, int reps ); 329extern void EndPopups ( XParms xp, Parms p ); 330 331 332/***************************************************************************** 333 334About x11perf: 335 336Many graphics benchmarks assume that the graphics device is used to display the 337output of a single fancy graphics application, and that the user gets his work 338done on some other device, like a terminal. Such benchmarks usually measure 339drawing speed for lines, polygons, text, etc. 340 341Since workstations are not used as standalone graphics engines, but as 342super-terminals, x11perf measures window management performance as well as 343traditional graphics performace. x11perf includes benchmarks for the time it 344takes to create and map windows (as when you start up an application); to map a 345pre-existing set of windows onto the screen (as when you deiconify an 346application or pop up a menu); and to rearrange windows (as when you slosh 347windows to and fro trying to find the one you want). 348 349x11perf also measures graphics performance for operations not normally used in 350standalone graphics displays, but are nonetheless used frequently by X 351applications. Such operations include CopyPlane (used by the PostScript 352previewer), scrolling (used in text windows), and various stipples and tiles 353(used for CAD and half-toning, respectively). 354 355x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones'' 356number. We consider such numbers to be uninformative at best and misleading at 357worst. x11perf should be used to analyze particular strengths and weaknesses 358of servers, and is most useful when used by a server writer who wants to 359analyze and improve a server. 360 361For repeatable results, x11perf should be run using a local connection on a 362freshly-started server. The default configuration runs each test 5 times, in 363order to see if each trial takes approximately the same amount of time. 364Strange glitches should be examined; if non-repeatable I chalk them up to 365daemons and network traffic. Each trial is run for 5 seconds, in order to 366reduce random time differences. The number of objects processed per second is 367displayed to 3 significant digits, but you'll be lucky on most UNIX system if 368the numbers are actually consistent to 2 digits. 369 370The current program is mostly the responsibility of Joel McCormack. It is 371based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris 372Kent, who wanted to assess performance differences between various servers. 373Mary Walker, Todd Newman, and I added several tests in order to write and tune 374the pmax (DECStation 3100) servers. For a general release to the world, I've 375basically rewritten x11perf to ease making comparisons between widely varying 376machines, to cover most important X functionality (the notable exception being 377wide lines), and to exercise graphics operations in as many different 378orientations and alignments as possible. 379 380******************************************************************************/ 381