1 /* Copyright (C)2004 Landmark Graphics Corporation
2  * Copyright (C)2005-2007 Sun Microsystems, Inc.
3  * Copyright (C)2009-2013, 2015-2021 D. R. Commander
4  *
5  * This library is free software and may be redistributed and/or modified under
6  * the terms of the wxWindows Library License, Version 3.1 or (at your option)
7  * any later version.  The full license is in the LICENSE.txt file included
8  * with this distribution.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * wxWindows Library License for more details.
14  */
15 
16 #ifndef __RR_H
17 #define __RR_H
18 
19 #define RR_MAJOR_VERSION  2
20 #define RR_MINOR_VERSION  1
21 
22 /* Argh! */
23 #if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
24 #pragma pack(1)
25 #endif
26 
27 /* Header contained in all frame structures */
28 typedef struct _rrframeheader
29 {
30   unsigned int size;       /* If this frame is compressed, the size (in bytes)
31                               of the compressed image that represents it */
32   unsigned int winid;      /* The ID of the window on the client into which
33                               this frame should be drawn (usually this is the
34                               X11 Window handle) */
35   unsigned short framew;   /* The width of the entire frame (in pixels) */
36   unsigned short frameh;   /* The height of the entire frame (in pixels) */
37   unsigned short width;    /* The width of this tile (in pixels) */
38   unsigned short height;   /* The height of this tile (in pixels) */
39   unsigned short x;        /* The X offset of this tile within the frame */
40   unsigned short y;        /* The Y offset of this tile within the frame */
41   unsigned char qual;      /* Quality used when compressing the image
42                               (1-100) */
43   unsigned char subsamp;   /* Chrominance subsampling used when compressing
44                               the image. (1=4:4:4, 2=4:2:2, 4=4:2:0) */
45   unsigned char flags;     /* See enum below */
46   unsigned char compress;  /* Compression algorithm (see enum below) */
47   unsigned short dpynum;   /* Display number on the client that contains the
48                               window into which this frame will be drawn */
49 } rrframeheader;
50 #define sizeof_rrframeheader  26
51 
52 typedef struct _rrversion
53 {
54   char id[3];
55   unsigned char major;
56   unsigned char minor;
57 } rrversion;
58 #define sizeof_rrversion  5
59 
60 /* Header from version 1 of the VirtualGL protocol (used to communicate with
61    older clients */
62 typedef struct _rrframeheader_v1
63 {
64   unsigned int size;       /* If this frame is compressed, the size (in bytes)
65                               of the compressed image that represents it */
66   unsigned int winid;      /* The ID of the window on the client into which
67                               this frame should be drawn (usually this is the
68                               X11 Window handle) */
69   unsigned short framew;   /* The width of the entire frame (in pixels) */
70   unsigned short frameh;   /* The height of the entire frame (in pixels) */
71   unsigned short width;    /* The width of this tile (in pixels) */
72   unsigned short height;   /* The height of this tile (in pixels) */
73   unsigned short x;        /* The X offset of this tile within the frame */
74   unsigned short y;        /* The Y offset of this tile within the frame */
75   unsigned char qual;      /* Quality used when compressing the image
76                               (1-100) */
77   unsigned char subsamp;   /* Chrominance subsampling used when compressing
78                               the image. (1=4:4:4, 2=4:2:2, 4=4:2:0) */
79   unsigned char flags;     /* See enum below */
80   unsigned char dpynum;    /* Display number on the client that contains the
81                               window into which this frame will be drawn */
82 } rrframeheader_v1;
83 #define sizeof_rrframeheader_v1  24
84 
85 /* Header flags */
86 enum
87 {
88   RR_EOF = 1,  /* this tile is an End-of-Frame marker and contains no real
89                   image data */
90   RR_LEFT,     /* this tile goes to the left buffer of a stereo frame */
91   RR_RIGHT     /* this tile goes to the right buffer of a stereo frame */
92 };
93 
94 /* Transport types */
95 #define RR_TRANSPORTOPT  3
96 enum rrtrans
97 {
98   RRTRANS_X11 = 0, RRTRANS_VGL, RRTRANS_XV
99 };
100 
101 /* Compression types */
102 #define RR_COMPRESSOPT  5
103 enum rrcomp
104 {
105   RRCOMP_PROXY = 0, RRCOMP_JPEG, RRCOMP_RGB, RRCOMP_XV, RRCOMP_YUV
106 };
107 
108 /* Readback types */
109 #define RR_READBACKOPT  3
110 enum rrread { RRREAD_NONE = 0, RRREAD_SYNC, RRREAD_PBO };
111 
112 static const enum rrtrans _Trans[RR_COMPRESSOPT] =
113 {
114   RRTRANS_X11, RRTRANS_VGL, RRTRANS_VGL, RRTRANS_XV, RRTRANS_VGL
115 };
116 
117 static const int _Minsubsamp[RR_COMPRESSOPT] =
118 {
119   -1, 0, -1, 4, 4
120 };
121 
122 static const int _Defsubsamp[RR_COMPRESSOPT] =
123 {
124   1, 1, 1, 4, 4
125 };
126 
127 static const int _Maxsubsamp[RR_COMPRESSOPT] =
128 {
129   -1, 4, -1, 4, 4
130 };
131 
132 /* Stereo options */
133 #define RR_STEREOOPT  9
134 enum rrstereo
135 {
136   RRSTEREO_LEYE = 0, RRSTEREO_REYE, RRSTEREO_QUADBUF, RRSTEREO_REDCYAN,
137   RRSTEREO_GREENMAGENTA, RRSTEREO_BLUEYELLOW, RRSTEREO_INTERLEAVED,
138   RRSTEREO_TOPBOTTOM, RRSTEREO_SIDEBYSIDE
139 };
140 
141 /* Other */
142 #define RR_DEFAULTPORT  4242
143 #ifdef USESSL
144 #define RR_DEFAULTSSLPORT  4243
145 #else
146 #define RR_DEFAULTSSLPORT  RR_DEFAULTPORT
147 #endif
148 #define RR_DEFAULTTILESIZE  256
149 
150 /* Maximum threads that be can be used for parallel image compression */
151 /* (the algorithms don't scale beyond 3) */
152 #define MAXPROCS  4
153 
154 #define MAXSTR  256
155 
156 /* Faker configuration */
157 typedef struct _FakerConfig
158 {
159   char allowindirect;
160   char autotest;
161   char client[MAXSTR];
162   int compress;
163   char config[MAXSTR];
164   char defaultfbconfig[MAXSTR];
165   char dlsymloader;
166   char egl;
167   #ifdef EGLBACKEND
168   char egllib[MAXSTR];
169   #endif
170   double flushdelay;
171   int forcealpha;
172   double fps;
173   double gamma;
174   unsigned char gamma_lut[256];
175   unsigned short gamma_lut10[1024], gamma_lut16[65536];
176   char glflushtrigger;
177   char gllib[MAXSTR];
178   char glxvendor[MAXSTR];
179   char gui;
180   unsigned int guikey;
181   char guikeyseq[MAXSTR];
182   unsigned int guimod;
183   char interframe;
184   char localdpystring[MAXSTR];
185   char log[MAXSTR];
186   char logo;
187   int np;
188   int port;
189   char probeglx;
190   int qual;
191   char readback;
192   double refreshrate;
193   int samples;
194   char spoil;
195   char spoillast;
196   char ssl;
197   int stereo;
198   int subsamp;
199   char sync;
200   int tilesize;
201   char trace;
202   int transpixel;
203   char transport[MAXSTR];
204   char transvalid[RR_TRANSPORTOPT];
205   char trapx11;
206   char vendor[MAXSTR];
207   char verbose;
208   char wm;
209   char x11lib[MAXSTR];
210   char fakeXCB;
211   char xcblib[MAXSTR];
212   char xcbglxlib[MAXSTR];
213   char xcbkeysymslib[MAXSTR];
214   char xcbx11lib[MAXSTR];
215   char excludeddpys[MAXSTR];
216   char ocllib[MAXSTR];
217   char amdgpuHack;
218 } FakerConfig;
219 
220 #if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
221 #pragma pack()
222 #endif
223 
224 #endif
225