x11perf.h revision e4ee1255
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 int InitShmGetImage ( XParms xp, Parms p, int reps );
187extern void DoShmPutImage ( XParms xp, Parms p, int reps );
188extern void DoShmGetImage ( XParms xp, Parms p, int reps );
189extern void EndShmPutImage ( XParms xp, Parms p );
190extern void EndShmGetImage ( XParms xp, Parms p );
191#endif
192extern void MidCopyPix ( XParms xp, Parms p );
193extern void EndCopyWin ( XParms xp, Parms p );
194extern void EndCopyPix ( XParms xp, Parms p );
195extern void EndGetImage ( XParms xp, Parms p );
196extern int InitCopyPlane ( XParms xp, Parms p, int reps );
197extern void DoCopyPlane ( XParms xp, Parms p, int reps );
198
199int
200InitCompositeWin(XParms xp, Parms p, int reps);
201
202void
203EndCompositeWin (XParms xp, Parms p);
204
205void
206DoCompositeWinWin (XParms xp, Parms p, int reps);
207
208int
209InitCompositePix(XParms xp, Parms p, int reps);
210
211void
212EndCompositePix (XParms xp, Parms p);
213
214void
215DoCompositePixWin (XParms xp, Parms p, int reps);
216
217/* do_complex.c */
218extern int InitComplexPoly ( XParms xp, Parms p, int reps );
219extern void DoComplexPoly ( XParms xp, Parms p, int reps );
220extern void EndComplexPoly ( XParms xp, Parms p );
221extern int InitGeneralPoly ( XParms xp, Parms p, int reps );
222extern void DoGeneralPoly ( XParms xp, Parms p, int reps );
223
224/* do_dots.c */
225extern int InitDots ( XParms xp, Parms p, int reps );
226extern void DoDots ( XParms xp, Parms p, int reps );
227extern void EndDots ( XParms xp, Parms p );
228
229/* do_lines.c */
230extern int InitLines ( XParms xp, Parms p, int reps );
231extern int InitWideLines ( XParms xp, Parms p, int reps );
232extern int InitDashedLines ( XParms xp, Parms p, int reps );
233extern int InitWideDashedLines ( XParms xp, Parms p, int reps );
234extern int InitDoubleDashedLines ( XParms xp, Parms p, int reps );
235extern int InitWideDoubleDashedLines ( XParms xp, Parms p, int reps );
236extern void DoLines ( XParms xp, Parms p, int reps );
237extern void EndLines ( XParms xp, Parms p );
238
239/* do_movewin.c */
240extern int InitMoveWindows ( XParms xp, Parms p, int reps );
241extern void DoMoveWindows ( XParms xp, Parms p, int reps );
242extern void EndMoveWindows ( XParms xp, Parms p );
243extern void DoResizeWindows ( XParms xp, Parms p, int reps );
244extern int InitCircWindows ( XParms xp, Parms p, int reps );
245extern void DoCircWindows ( XParms xp, Parms p, int reps );
246extern void EndCircWindows ( XParms xp, Parms p );
247extern int InitMoveTree ( XParms xp, Parms p, int reps );
248extern void DoMoveTree ( XParms xp, Parms p, int reps );
249extern void EndMoveTree ( XParms xp, Parms p );
250
251/* do_rects.c */
252extern int InitRectangles ( XParms xp, Parms p, int reps );
253extern void DoRectangles ( XParms xp, Parms p, int reps );
254extern void DoOutlineRectangles ( XParms xp, Parms p, int reps );
255extern void EndRectangles ( XParms xp, Parms p );
256
257/* do_segs.c */
258extern int InitSegments ( XParms xp, Parms p, int reps );
259extern int InitDashedSegments ( XParms xp, Parms p, int reps );
260extern int InitDoubleDashedSegments ( XParms xp, Parms p, int reps );
261extern int InitHorizSegments ( XParms xp, Parms p, int reps );
262extern int InitWideHorizSegments ( XParms xp, Parms p, int reps );
263extern int InitVertSegments ( XParms xp, Parms p, int reps );
264extern int InitWideVertSegments ( XParms xp, Parms p, int reps );
265extern void DoSegments ( XParms xp, Parms p, int reps );
266extern void EndSegments ( XParms xp, Parms p );
267
268/* do_simple.c */
269extern void DoNoOp ( XParms xp, Parms p, int reps );
270extern void DoGetAtom ( XParms xp, Parms p, int reps );
271extern void DoQueryPointer ( XParms xp, Parms p, int reps );
272extern int InitGetProperty ( XParms xp, Parms p, int reps );
273extern void DoGetProperty ( XParms xp, Parms p, int reps );
274
275/* do_text.c */
276extern int InitText ( XParms xp, Parms p, int reps );
277extern int InitText16 ( XParms xp, Parms p, int reps );
278extern void DoText ( XParms xp, Parms p, int reps );
279extern void DoText16 ( XParms xp, Parms p, int reps );
280extern void DoPolyText ( XParms xp, Parms p, int reps );
281extern void DoPolyText16 ( XParms xp, Parms p, int reps );
282extern void DoImageText ( XParms xp, Parms p, int reps );
283extern void DoImageText16 ( XParms xp, Parms p, int reps );
284extern void ClearTextWin ( XParms xp, Parms p );
285extern void EndText ( XParms xp, Parms p );
286extern void EndText16 ( XParms xp, Parms p );
287#ifdef XFT
288extern int InitAAText (XParms xp, Parms p, int reps );
289extern void DoAAText (XParms xp, Parms p, int reps );
290extern void EndAAText ( XParms xp, Parms p );
291#endif
292
293/* do_traps.c */
294extern int InitTrapezoids ( XParms xp, Parms p, int reps );
295extern void DoTrapezoids ( XParms xp, Parms p, int reps );
296extern void EndTrapezoids ( XParms xp, Parms p );
297#if defined(XRENDER) && defined(XFT)
298extern int InitFixedTraps ( XParms xp, Parms p, int reps );
299extern void DoFixedTraps ( XParms xp, Parms p, int reps );
300extern void EndFixedTraps ( XParms xp, Parms p );
301extern int InitFixedTrapezoids ( XParms xp, Parms p, int reps );
302extern void DoFixedTrapezoids ( XParms xp, Parms p, int reps );
303extern void EndFixedTrapezoids ( XParms xp, Parms p );
304#endif
305
306/* do_tris.c */
307extern int InitTriangles ( XParms xp, Parms p, int reps );
308extern void DoTriangles ( XParms xp, Parms p, int reps );
309extern void EndTriangles ( XParms xp, Parms p );
310
311/* do_valgc.c */
312extern int InitGC ( XParms xp, Parms p, int reps );
313extern void DoChangeGC ( XParms xp, Parms p, int reps );
314extern void EndGC ( XParms xp, Parms p );
315
316/* do_windows.c */
317extern int CreateParents ( XParms xp, Parms p, int reps );
318extern void MapParents ( XParms xp, Parms p, int reps );
319extern void MapParentsCleanup ( XParms xp, Parms p );
320extern int InitCreate ( XParms xp, Parms p, int reps );
321extern void CreateChildren ( XParms xp, Parms p, int reps );
322extern void DestroyChildren ( XParms xp, Parms p );
323extern void EndCreate ( XParms xp, Parms p );
324extern int InitMap ( XParms xp, Parms p, int reps );
325extern void UnmapParents ( XParms xp, Parms p, int reps );
326extern void UnmapParentsCleanup ( XParms xp, Parms p);
327extern int InitDestroy ( XParms xp, Parms p, int reps );
328extern void DestroyParents ( XParms xp, Parms p, int reps );
329extern void RenewParents ( XParms xp, Parms p );
330extern int InitPopups ( XParms xp, Parms p, int reps );
331extern void DoPopUps ( XParms xp, Parms p, int reps );
332extern void EndPopups ( XParms xp, Parms p );
333
334
335/*****************************************************************************
336
337About x11perf:
338
339Many graphics benchmarks assume that the graphics device is used to display the
340output of a single fancy graphics application, and that the user gets his work
341done on some other device, like a terminal.  Such benchmarks usually measure
342drawing speed for lines, polygons, text, etc.
343
344Since workstations are not used as standalone graphics engines, but as
345super-terminals, x11perf measures window management performance as well as
346traditional graphics performace.  x11perf includes benchmarks for the time it
347takes to create and map windows (as when you start up an application); to map a
348pre-existing set of windows onto the screen (as when you deiconify an
349application or pop up a menu); and to rearrange windows (as when you slosh
350windows to and fro trying to find the one you want).
351
352x11perf also measures graphics performance for operations not normally used in
353standalone graphics displays, but are nonetheless used frequently by X
354applications.  Such operations include CopyPlane (used by the PostScript
355previewer), scrolling (used in text windows), and various stipples and tiles
356(used for CAD and half-toning, respectively).
357
358x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones''
359number.  We consider such numbers to be uninformative at best and misleading at
360worst.  x11perf should be used to analyze particular strengths and weaknesses
361of servers, and is most useful when used by a server writer who wants to
362analyze and improve a server.
363
364For repeatable results, x11perf should be run using a local connection on a
365freshly-started server.  The default configuration runs each test 5 times, in
366order to see if each trial takes approximately the same amount of time.
367Strange glitches should be examined; if non-repeatable I chalk them up to
368daemons and network traffic.  Each trial is run for 5 seconds, in order to
369reduce random time differences.  The number of objects processed per second is
370displayed to 3 significant digits, but you'll be lucky on most UNIX system if
371the numbers are actually consistent to 2 digits.
372
373The current program is mostly the responsibility of Joel McCormack.  It is
374based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris
375Kent, who wanted to assess performance differences between various servers.
376Mary Walker, Todd Newman, and I added several tests in order to write and tune
377the pmax (DECStation 3100) servers.  For a general release to the world, I've
378basically rewritten x11perf to ease making comparisons between widely varying
379machines, to cover most important X functionality (the notable exception being
380wide lines), and to exercise graphics operations in as many different
381orientations and alignments as possible.
382
383******************************************************************************/
384