rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / x11 / libdga / src / dga_winshared.h
blob8806052f9b8136825cf4e3ef1a89c27ad6575f7d
1 /* Copyright (c) 1993, 1998, Oracle and/or its affiliates. All rights reserved.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
25 * dga_winshared.h - Sun Direct Graphics Access shared page include file.
28 #ifndef _DGA_WINSHARED_H
29 #define _DGA_WINSHARED_H
31 #include "dga_externaldefs.h"
32 #include <sys/int_types.h>
36 /* Mbufset Shared Info format */
37 typedef struct dga_mbufset_shinfo {
38 unsigned int mbufseq; /* incremented on composition or display
39 * change */
40 unsigned int compositionseq; /* incremented on composition change */
41 unsigned char enabled; /* nonzero if an mbufset is active */
42 unsigned char flipMode; /* 0 = video flip; 1 = copy flip */
43 unsigned char accessMode; /* 0 = single addr; 1 = multi addr */
44 unsigned char siteTypeConst; /* zero if access mode can change */
45 uint32_t bufViewableFlags; /* bit n is 1 if buf n is viewable */
46 unsigned int nmbufShpxToken; /* token for shared pixmap file nonviewable
47 * multibuf */
48 XID nmbufIds[DGA_MAX_GRABBABLE_BUFS]; /* XID's of nonviewable
49 * mbufs */
50 #if !defined(_LP64) && !defined(_I32LPX)
51 int pad_bufIds[DGA_MAX_GRABBABLE_BUFS];
52 #endif
53 } DgaMbufSetShinfo, *DgaMbufSetShinfoPtr;
57 * This portion of the file file describes the shared memory info page
58 * used by the window
59 * grabber. Many of the structures are shapes specific, and their
60 * definitions are copied from shapes #include files. If the shapes
61 * structures are changed, then this file would be messed up; but
62 * if that happens, a lot of other things would get messed up too, so
63 * let's hope that it never happens.
65 * This structure is defined in such a way as to allow expansion. In
66 * particular, the field 'w_clipoff' contains the offset, in bytes, of
67 * the clip data relative to the start of the window information area.
68 * Do not attempt to refer directly to the 'w_shape_hdr' element of
69 * this structure, as that can cause old executables to break with new
70 * servers.
72 * Here is a brief description of the WXINFO structure elements
73 * which are relavent to the client:
75 * w_flag set to WMODIF by the server whenever any field
76 * in the window info area is changed. Set back to
77 * WSEEN by the client once the info has been read.
78 * The window-info area should be locked while examining
79 * this flag and copying information from the
80 * window-info area.
81 * w_magic Set to 0x47524142 ("GRAB").
82 * w_version version of window-info area. This header file
83 * currently describes version 1. Programs should
84 * check the version number and either refuse to run
85 * with older versions or at least be careful not to
86 * use fields not defined in older versions. The
87 * comments in the WXINFO structure definition will
88 * show you which these are.
89 * w_devname Ascii device name. Let's hope there's never a
90 * framebuffer with a filename larger than 20 characters.
91 * w_cinfofd File descriptor of wininfo file. This file has
92 * been mmap'ed, so there is no reason for the
93 * application to need to use this.
94 * w_cdevfd File descriptor of the framebuffer named in w_devname.
95 * w_crefcnt Lock count for nested locking.
96 * w_cookie Internal use only. NOT related to the window cookie
97 * that was returned by X_GrabWindow().
98 * w_clockp pointer to lockpage, used by wx_lock().
99 * w_clipoff Byte offset from start of info page to start of
100 * clip list.
101 * w_clipsize size of cliplist.
102 * w_org, w_dim window dimensions, i.e. bounding box of whole window
103 * In 16-bit signed fract format.
104 * w_shape cliplist info
105 * w_depth depth of window
106 * w_borderwidth server's idea of the window's bw. This need not be
107 * equal to what the client requested since
108 * something like OLWM could override the client
109 * request and the clinet now has wrong bw.
111 * Interpreting the clip info:
113 * The client is interested in the following structures:
114 * w_shape_hdr pointed to via the wx_clipinfo macro.
115 * w_shape contains flags and a bounding-box for the cliplist.
116 * cliparray follows w_shape. Contains the clip list.
118 * w_shape.SHAPE_FLAGS contains flags that describe the cliplist. If
119 * DGA_SH_EMPTY_FLAG is set, then the clip list is empty (window obscured or
120 * something).
122 * If DGA_SH_RECT_FLAG is set, the clip list is a single rectangle
123 * described by w_shape->SHAPE_{XMIN,YMIN,XMAX,YMAX}.
125 * For non-empty cliplists, use the dga_win_clipinfo(win) routine to get
126 * a pointer to the cliplist.
128 * "Normal" cliplists are a sequence of signed shorts which describes
129 * a sequence of rectangles. The data consists of a sequence of one
130 * or more ymin,ymax pairs, each of which is followed by a sequence of
131 * one or more xmin,xmax pairs. xmin,xmax sequences are terminated by
132 * a single value of DGA_X_EOL. ymin,ymax sequences are terminated by a
133 * single value of DGA_Y_EOL. This is best described with some sample
134 * code:
136 * short x0,y0,x1,y1;
138 * ptr = dga_win_clipinfo(win);
139 * while( (y0=*ptr++) != DGA_Y_EOL )
141 * y1 = *ptr++;
142 * while( (x0=*ptr++) != DGA_X_EOL )
144 * x1 = *ptr++;
145 * printf("rectangle from (%d,%d) to (%d,%d)\n",x0,y0,x1-1,y1-1);
149 * Note that the xmax, ymax values are actually one pixel too high. This
150 * may be a bug or a feature, I don't know.
154 #define DGA_DB_DEV_INFO_SZ 132
156 #if !defined (WMODIF) /* cliplist flag, one of: */
157 #define WMODIF 1 /* server has set a new cliplist */
158 #define WEXTEND 2 /* extended cliplist present */
159 #define WXMAGIC 0x47524142 /* "GRAB" */
160 #endif /* WMODIF */
162 #define WX_PAGESZ (8*1024)
165 typedef struct {
166 unsigned int t;
167 int x, y;
168 } POINT_B2D;
171 typedef struct {
172 short x, y;
173 } Dga_coord_2d;
176 #if !defined (_SH_CLASS)
177 #if defined(_LP64) || defined(_I32LPX)
178 typedef int OBJID;
179 typedef OBJID CLASS_OPER;
180 #else
181 typedef void *OBJID;
182 typedef OBJID (*CLASS_OPER)();
183 #endif
186 typedef struct {
187 unsigned char type;
188 unsigned char id;
189 } CLASS;
192 struct obj_hdr {
193 unsigned int obj_flags : 8;
194 unsigned int obj_size : 24;
195 CLASS obj_class;
196 unsigned short obj_use;
197 CLASS_OPER *obj_func;
198 #if !defined(_LP64) && !defined(_I32LPX)
199 int32_t pad_func;
200 #endif
202 #endif /* _SH_CLASS */
205 #if !defined (_SH_SHAPE_INT)
206 struct class_SHAPE_vn {
207 unsigned char SHAPE_FLAGS;
208 unsigned char SHAPE_SIZE; /* new with 1.1 */
209 short SHAPE_YMIN;
210 short SHAPE_YMAX;
211 short SHAPE_XMIN;
212 short SHAPE_XMAX;
213 short SHAPE_X_EOL;
214 #if 0
215 #if !defined(_LP64) && !defined(_I32LPX)
216 char pad_to_y_eol[2];
217 #endif
218 #endif
219 union {
220 short SHAPE_Y_EOL;
221 OBJID obj; /* new with 1.1 */
222 } u;
223 #if 0
224 #if !defined(_LP64) && !defined(_I32LPX)
225 int32_t pad_obj;
226 #endif
227 #endif
229 #define shape_obj u.obj
230 #define shape_xeol SHAPE_X_EOL
231 #define shape_yeol u.SHAPE_Y_EOL
232 #define SHAPE_RECT_SIZE (6 * sizeof (short))
233 #define SHAPE_NO_SIZE 0xFF
236 struct class_SHAPE_v0 {
237 unsigned char SHAPE_FLAGS;
238 short SHAPE_YMIN;
239 short SHAPE_YMAX;
240 short SHAPE_XMIN;
241 short SHAPE_XMAX;
242 short SHAPE_X_EOL;
243 short SHAPE_Y_EOL;
245 #endif /*_SH_SHAPE_INT*/
248 /* Cursor Grabber defines and structures */
250 #define DGA_CURSOR_DOWN 0
251 #define DGA_CURSOR_UP 1
252 #define DGA_CURG_MAGIC 0x43555247
255 typedef struct dga_curs_mpr {
256 u_int curg_linebytes;
257 Dga_coord_2d curg_dim;
258 u_char curg_depth;
259 /* image data floats under here */
260 } Dga_curs_mpr;
263 typedef struct dga_cursinfo
265 u_int c_magic; /* magic no, "CURG"=0x43555247 */
266 u_int c_filesuffix; /* to derive cursor grabber filename */
267 uint32_t c_pad; /* No longer used */
268 int c_scurgfd; /* file descriptor for server */
269 int c_ref_cnt; /* total number of cur-grabbers*/
270 int c_state_flag; /* client/server can set this */
271 u_int c_chng_cnt; /* Change count */
272 int c_index; /* entry no. in global array */
273 Dga_coord_2d c_org; /* top left */
274 Dga_coord_2d c_hot_spot; /* why bother with this? */
275 int c_offset; /* offset in bytes from top of
276 * page to save_under info */
277 Dga_curs_mpr *c_sptr; /* server's ptr to save_unders*/
278 u_int c_cookie; /* "cookie" for lock pages */
279 #if defined(_LP64) || defined(_I32LPX)
280 void* c_slockp; /* all windows on this screen use */
281 void* c_sunlockp; /* the same lock context */
282 #else
283 void* c_slockp; /* all windows on this screen use */
284 void* c_sunlockp; /* the same lock context */
285 #endif
286 int c_locktype;
287 int c_smemsize; /* number of bytes for saved cursor */
290 * FLOATING INFO STARTS HERE, CLIENT DO NOT
291 * REFER DIRECTLY TO ANYTHING BELOW THIS LINE.
294 Dga_curs_mpr c_saved_under; /* this gets puts back up */
296 } Dga_cursinfo;
299 typedef struct wx_dbinfo {
300 short number_buffers;
301 short read_buffer;
302 short write_buffer;
303 short display_buffer;
304 u_int reserved_1;
305 u_int reserved_2;
306 u_int reserved_3;
307 u_int reserved_4;
308 u_int reserved_5;
309 u_int WID; /* Mpg window id. */
310 u_int UNIQUE;
311 u_char device_info[DGA_DB_DEV_INFO_SZ];
312 } DBINFO;
314 /* Ancillary Buffers ... */
315 #ifndef True
316 #define True 1
317 #define False 0
318 #endif
320 #ifndef DGA_NUM_BUFFER_TYPES
321 /* The following buffer types also defined(duplicated) in dga.h file.
322 * I can't include dga.h in hw/solaris/dga due to some declarations
323 * inconsistency. Whenever someone changes/addes/deleted
324 * to this enumerated values, please also update dga.h which is located
325 * in xc/include/dga/. Also ddx uses this.
327 typedef enum {
328 DGA_DEPTH_BUFFER = 0,
329 DGA_STENCIL_BUFFER,
330 DGA_ACCUM_BUFFER,
331 DGA_ALPHA_BUFFER,
332 DGA_BACK_BUFFER,
333 DGA_AUX_BUFFER0,
334 DGA_AUX_BUFFER1,
335 DGA_AUX_BUFFER2,
336 DGA_AUX_BUFFER3
337 } Dga_buffer_type;
339 #define DGA_NUM_BUFFER_TYPES (DGA_AUX_BUFFER3+1)
340 #endif
342 /* dga_buffer: This structure will contain pDraw pointer and
343 * buffer_site as his first two members, since all the buffer
344 * API's type case the pointer to dga_buffer and dereference
345 * the buffer_site value.
346 * pDraw -> Will be assigned at the client side.
347 * buffer_site -> Software Buffers - DGA_SITE_SYSTEM
348 * Hardware Buffers - DGA_SITE_DEVICE
349 * fn -> shared of file name of the specified buffer.
350 * buffer_type -> Type of the buffer.
351 * sitechg -> Initialized to DGA_SITECHG_INITIAL when the
352 * buffer is created. When the buffer is getting
353 * reallocated, this will have DGA_SITECHG_CACHE.
354 * bitsPerPixel -> depth of the buffer
355 * bytesPerPixel-> (bitsPerPixel +7) >> 3
356 * width -> buffer width (Window's width)
357 * height -> buffer height (Window's height)
358 * linebytes -> ((bytesPerPixel * width) + 3) & ~3
359 * b_offset -> offset to data member from buffer address
360 * allocsize -> Shared file size.
361 * data -> Buffer data bits pointer.
362 * pad -> Padding to make sure it is 64-bit aligned, for now.
364 typedef struct {
365 #if defined(_LP64) || defined(_I32LPX)
366 void *pDraw;
367 #else
368 void* pDraw;
369 int pad_pdraw;
370 #endif
371 Bool buffer_site;
372 int buffer_type;
373 Bool sitechg;
374 int grab_cnt;
375 u_char fn[256];
376 int width;
377 int height;
378 int bitsPerPixel;
379 int bytesPerPixel;
380 int linebytes;
381 int b_offset;
382 int allocsize;
383 #if defined(_LP64) || defined(_I32LPX)
384 uint32_t data;
385 #else
386 void* data;
387 #endif
388 char pad[4];
389 } dga_buffer_rec, * dga_buffer;
392 typedef struct {
393 #if defined(_LP64) || defined(_I32LPX)
394 dga_buffer bufferp;
395 void *pDraw;
396 #else
397 dga_buffer bufferp;
398 int pad_bufferp;
399 void *pDraw;
400 int pad_pdraw;
401 #endif
402 int buf_size;
403 } dga_internal_buffer_rec, *dga_internal_buffer;
406 /* ABINFO: This structure contains buffer pointers and their
407 * respective filenames.
408 * s_modified -> Will be set to "1" when the buffer is resized.
409 * remap_flag -> This is used across server and client dga implementation
410 * buffer_swap -> swap counter.
413 typedef struct wx_abinfo {
414 int s_modified;
415 u_int buffer_swap;
416 int width; /* width & height are used to detect resize */
417 int height;
418 u_char back_fn[256];
419 u_char depth_fn[256];
420 u_char stencil_fn[256];
421 u_char accum_fn[256];
422 u_char alpha_fn[256];
423 #if defined(_LP64) || defined(_I32LPX)
424 dga_buffer back;
425 dga_buffer depth;
426 dga_buffer stencil;
427 dga_buffer accum;
428 dga_buffer alpha;
429 #else
430 dga_buffer back;
431 int pad_1_bufinfo;
432 dga_buffer depth;
433 int pad_2_bufinfo;
434 dga_buffer stencil;
435 int pad_3_bufinfo;
436 dga_buffer accum;
437 int pad_4_bufinfo;
438 dga_buffer alpha;
439 int pad_5_bufinfo;
440 #endif
441 Bool extPixmap;
442 #if !defined(_LP64) && !defined(_I32LPX)
443 int pad_pix;
444 #endif
445 XID tag;
446 #if !defined(_LP64) && !defined(_I32LPX)
447 int pad_tag;
448 #endif
449 XID vid;
450 #if !defined(_LP64) && !defined(_I32LPX)
451 int pad_vid;
452 #endif
453 int back_size;
454 int depth_size;
455 int stencil_size;
456 int accum_size;
457 int alpha_size;
458 } ABINFO;
460 typedef struct wx_winfo
462 /* VERSION 0 INFO STARTS HERE */
464 uint32_t w_flag; /* cliplist flag */
465 int32_t w_magic; /* magic number, "GRAB" = 0x47524142 */
466 int32_t w_version; /* version, currently 4 */
467 #if defined(_LP64) || defined(_I32LPX)
468 uint32_t w_cunlockp; /* used to be w_list */
469 /* points to unlock page */
470 #else
471 u_int *w_cunlockp; /* used to be w_list */
472 /* points to unlock page */
474 #endif
475 /* server info, meaningless to client */
477 int w_sinfofd; /* fd of wxinfo file */
478 int w_sdevfd; /* fd of framebuffer */
479 #if defined(_LP64) || defined(_I32LPX)
480 uint32_t w_slockp; /* pointer to lockpage */
481 #else
482 u_int *w_slockp; /* pointer to lockpage */
483 #endif
484 int w_srefcnt; /* lock count for nested locks */
487 /* client info */
489 char w_devname[20]; /* framebuffer device name */
490 int w_cinfofd; /* fd of wxinfo file */
491 int w_cdevfd; /* fd of framebuffer */
492 int w_crefcnt; /* lock count for nested locks */
494 uint32_t w_cookie; /* "cookie" for lock pages */
495 uint32_t w_filesuffix; /* "cookie" for info file */
496 #if defined(_LP64) || defined(_I32LPX)
497 uint32_t w_clockp; /* pointer to lock page */
498 #else
499 u_int *w_clockp; /* pointer to lock page */
500 #endif
503 /* clipping info */
505 #if defined(_LP64) || defined(_I32LPX)
506 uint32_t w_cclipptr; /* client virtual pointer to clip array. */
507 #else
508 short *w_cclipptr; /* client virtual pointer to clip array. */
509 #endif
510 u_int w_scliplen; /* server's size of cliplist in bytes. */
513 /* shapes stuff */
515 POINT_B2D w_org; /* origin of window */
516 POINT_B2D w_dim; /* size of window */
519 /* VERSION 1 INFO STARTS HERE */
520 #if !defined(_LP64) && !defined(_I32LPX)
521 char pad_to_union[4];
522 #endif
524 union {
525 struct {
526 int32_t w_clipoff; /* byte offset from wx_info to w_cliparray. */
527 int32_t w_shapeoff; /* byte offset from wx_info to w_shape. */
528 u_int w_clipseq; /* clip sequence number */
529 int32_t w_ccliplen; /* client's size of clip list in bytes. */
530 #if defined(_LP64) || defined(_I32LPX)
531 uint32_t w_sclipptr; /* server's pointer to clip array */
532 #else
533 int *w_sclipptr; /* server's pointer to clip array */
534 #endif
535 } vn;
536 struct {
537 struct obj_hdr w_shape_hdr; /* not useful to client */
538 struct class_SHAPE_v0 w_shape;
539 short w_cliparray;
540 } v0;
541 } u;
543 /* VERSION 2 INFO STARTS HERE */
545 /* cursor grabber info */
547 u_int c_filesuffix; /* to derive shared cursor filename */
548 #if defined(_LP64) || defined(_I32LPX)
549 uint32_t c_sinfo; /* pointer to server's cursor info */
550 uint32_t c_pad1; /* obsolete */
551 #else
552 Dga_cursinfo *c_sinfo; /* pointer to server's cursor info */
553 void *c_pad1; /* obsolete */
554 #endif
555 int c_pad2; /* obsolete */
557 /* wid info */
559 struct {
560 short number_wids; /* number of contiguous wids alloc */
561 short start_wid; /* starting wid */
562 short wid; /* current wid */
563 short reserved_1; /* for the future */
564 } w_wid_info; /* WID info structure */
566 /* integer version of window bounds */
568 struct {
569 int xleft, ytop; /* upper-left corner, in pixels */
570 int width, height; /* dimensions, in pixels */
571 } w_window_boundary;
574 /* db info */
576 struct wx_dbinfo wx_dbuf; /* double buffer info structure */
578 int w_auxdevfd; /* Aux fd for asynch devices */
579 char w_auxdevname[20]; /* Asynch device name */
580 short w_auxdevid; /* ID number for aux dev type */
581 short w_auxserveronly; /* To keep SERVER_ONLY's in sync */
582 #if defined(_LP64) || defined(_I32LPX)
583 uint32_t w_sunlockp; /* pointer to unlockpage */
584 #else
585 u_int *w_sunlockp; /* pointer to unlockpage */
586 #endif
587 int w_extnd_seq; /* cliplist extension counter */
588 int w_clientcnt; /* # of clients using new protocol */
589 int w_oldproto; /* client used old protocol */
590 int w_locktype; /* what type of locking */
592 #if defined(_LP64) || defined(_I32LPX)
593 uint32_t wdev; /* pointer to server-internal data */
594 uint32_t w_srtndlink; /* server's retained struct pointer */
595 #else
596 void *wdev; /* pointer to server-internal data */
597 char *w_srtndlink; /* server's retained struct pointer */
598 #endif
599 u_int w_chng_cnt; /* bumped when anything changes */
602 /* VERSION 3 INFO STARTS HERE */
604 u_char w_depth; /* Window depth */
605 u_char pad[1]; /* Padding for int alignment */
606 u_short w_borderwidth; /* Actual bw of the window */
607 float w_refresh_period; /* monitor refresh period- millisec */
608 #if !defined(_LP64) && !defined(_I32LPX)
609 char pad_rfresh[4];
610 #endif
613 * Attributes of multibuffer set
615 * Note: the number of buffers in an mbuf set is specified by
616 * wx_dbuf.number_buffers.
619 DgaMbufSetShinfo w_mbsInfo; /*info for multibuf set (if win is mbuf) */
620 #if !defined(_LP64) && !defined(_I32LPX)
621 char pad_mbsinfo[4];
622 #endif
623 u_int w_devinfoseq; /*devinfo seq. # in the Dga_dbinfo struct.*/
624 int w_obsolete; /* 0 when shinfo no longer is valid */
625 int w_visibility; /* visibility of window. */
627 /* VERSION 4 INFO STARTS HERE */
629 Bool w_ovlshapevalid; /* client will clear this when locking */
630 /* so the server knows to recalculate */
631 /* the overlay's opaque shape */
632 int w_ovlstate; /* conflict mode of an overlay, one of: */
633 /* MPG_NONE => DGA_OVLSTATE_SAFE */
634 /* MPG_SAFE => DGA_OVLSTATE_SAFE */
635 /* MPG_SOFT => DGA_OVLSTATE_MULTIWID */
636 /* MPG_HARD => DGA_OVLSTATE_CONFLICT */
638 /* VERSION 5 INFO STARTS HERE */
639 #if !defined(_LP64) && !defined(_I32LPX)
640 char pad_ovlstate[4];
641 #endif
643 struct wx_abinfo wx_abuf; /* Ancillay Buffers info structure */
644 #if !defined(_LP64) && !defined(_I32LPX)
645 char pad_szinfo[4];
646 #endif
647 int info_sz;
650 * FLOATING INFO STARTS HERE, DO NOT REFER
651 * DIRECTLY TO ANYTHING BELOW THIS LINE.
653 #if 0
654 #if !defined(_LP64) && !defined(_I32LPX)
655 char pad_abinfo[4];
656 #endif
657 #endif
659 struct class_SHAPE_vn w_shape;
660 short w_cliparray;
662 } WXINFO;
664 #define WG_LOCKDEV 0 /* use GRABPAGEALLOC from fb */
665 #define WG_WINLOCK 1 /* use winlock functions */
667 #endif /* _DGA_WINSHARED_H */