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