*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* dga_winshared.h - Sun Direct Graphics Access shared page include file.
*/
#ifndef _DGA_WINSHARED_H
#define _DGA_WINSHARED_H
#include "dga_externaldefs.h"
#include <sys/int_types.h>
/* Mbufset Shared Info format */
typedef struct dga_mbufset_shinfo {
* change */
* multibuf */
* mbufs */
#endif
/*
* This portion of the file file describes the shared memory info page
* used by the window
* grabber. Many of the structures are shapes specific, and their
* definitions are copied from shapes #include files. If the shapes
* structures are changed, then this file would be messed up; but
* if that happens, a lot of other things would get messed up too, so
* let's hope that it never happens.
*
* This structure is defined in such a way as to allow expansion. In
* particular, the field 'w_clipoff' contains the offset, in bytes, of
* the clip data relative to the start of the window information area.
* Do not attempt to refer directly to the 'w_shape_hdr' element of
* this structure, as that can cause old executables to break with new
* servers.
*
* Here is a brief description of the WXINFO structure elements
* which are relavent to the client:
*
* w_flag set to WMODIF by the server whenever any field
* in the window info area is changed. Set back to
* WSEEN by the client once the info has been read.
* The window-info area should be locked while examining
* this flag and copying information from the
* window-info area.
* w_magic Set to 0x47524142 ("GRAB").
* w_version version of window-info area. This header file
* currently describes version 1. Programs should
* check the version number and either refuse to run
* with older versions or at least be careful not to
* use fields not defined in older versions. The
* comments in the WXINFO structure definition will
* show you which these are.
* w_devname Ascii device name. Let's hope there's never a
* framebuffer with a filename larger than 20 characters.
* w_cinfofd File descriptor of wininfo file. This file has
* been mmap'ed, so there is no reason for the
* application to need to use this.
* w_cdevfd File descriptor of the framebuffer named in w_devname.
* w_crefcnt Lock count for nested locking.
* w_cookie Internal use only. NOT related to the window cookie
* that was returned by X_GrabWindow().
* w_clockp pointer to lockpage, used by wx_lock().
* w_clipoff Byte offset from start of info page to start of
* clip list.
* w_clipsize size of cliplist.
* w_org, w_dim window dimensions, i.e. bounding box of whole window
* In 16-bit signed fract format.
* w_shape cliplist info
* w_depth depth of window
* w_borderwidth server's idea of the window's bw. This need not be
* equal to what the client requested since
* something like OLWM could override the client
* request and the clinet now has wrong bw.
*
* Interpreting the clip info:
*
* The client is interested in the following structures:
* w_shape_hdr pointed to via the wx_clipinfo macro.
* w_shape contains flags and a bounding-box for the cliplist.
* cliparray follows w_shape. Contains the clip list.
*
* w_shape.SHAPE_FLAGS contains flags that describe the cliplist. If
* DGA_SH_EMPTY_FLAG is set, then the clip list is empty (window obscured or
* something).
*
* If DGA_SH_RECT_FLAG is set, the clip list is a single rectangle
* described by w_shape->SHAPE_{XMIN,YMIN,XMAX,YMAX}.
*
* For non-empty cliplists, use the dga_win_clipinfo(win) routine to get
* a pointer to the cliplist.
*
* "Normal" cliplists are a sequence of signed shorts which describes
* a sequence of rectangles. The data consists of a sequence of one
* or more ymin,ymax pairs, each of which is followed by a sequence of
* one or more xmin,xmax pairs. xmin,xmax sequences are terminated by
* a single value of DGA_X_EOL. ymin,ymax sequences are terminated by a
* single value of DGA_Y_EOL. This is best described with some sample
* code:
*
* short x0,y0,x1,y1;
*
* ptr = dga_win_clipinfo(win);
* while( (y0=*ptr++) != DGA_Y_EOL )
* {
* y1 = *ptr++;
* while( (x0=*ptr++) != DGA_X_EOL )
* {
* x1 = *ptr++;
* printf("rectangle from (%d,%d) to (%d,%d)\n",x0,y0,x1-1,y1-1);
* }
* }
*
* Note that the xmax, ymax values are actually one pixel too high. This
* may be a bug or a feature, I don't know.
*
*/
#if !defined (WMODIF) /* cliplist flag, one of: */
#endif /* WMODIF */
typedef struct {
unsigned int t;
int x, y;
} POINT_B2D;
typedef struct {
short x, y;
} Dga_coord_2d;
#if !defined (_SH_CLASS)
typedef int OBJID;
#else
typedef void *OBJID;
#endif
typedef struct {
unsigned char type;
unsigned char id;
} CLASS;
struct obj_hdr {
unsigned short obj_use;
#endif
};
#endif /* _SH_CLASS */
#if !defined (_SH_SHAPE_INT)
struct class_SHAPE_vn {
unsigned char SHAPE_FLAGS;
short SHAPE_YMIN;
short SHAPE_YMAX;
short SHAPE_XMIN;
short SHAPE_XMAX;
short SHAPE_X_EOL;
#if 0
char pad_to_y_eol[2];
#endif
#endif
union {
short SHAPE_Y_EOL;
} u;
#if 0
#endif
#endif
};
struct class_SHAPE_v0 {
unsigned char SHAPE_FLAGS;
short SHAPE_YMIN;
short SHAPE_YMAX;
short SHAPE_XMIN;
short SHAPE_XMAX;
short SHAPE_X_EOL;
short SHAPE_Y_EOL;
};
#endif /*_SH_SHAPE_INT*/
/* Cursor Grabber defines and structures */
#define DGA_CURSOR_DOWN 0
typedef struct dga_curs_mpr {
/* image data floats under here */
} Dga_curs_mpr;
typedef struct dga_cursinfo
{
* page to save_under info */
#else
#endif
int c_locktype;
/*
* FLOATING INFO STARTS HERE, CLIENT DO NOT
* REFER DIRECTLY TO ANYTHING BELOW THIS LINE.
*/
} Dga_cursinfo;
typedef struct wx_dbinfo {
short number_buffers;
short read_buffer;
short write_buffer;
short display_buffer;
} DBINFO;
/* Ancillary Buffers ... */
#ifndef True
#define False 0
#endif
#ifndef DGA_NUM_BUFFER_TYPES
/* The following buffer types also defined(duplicated) in dga.h file.
* to this enumerated values, please also update dga.h which is located
*/
typedef enum {
DGA_DEPTH_BUFFER = 0,
#endif
/* dga_buffer: This structure will contain pDraw pointer and
* buffer_site as his first two members, since all the buffer
* API's type case the pointer to dga_buffer and dereference
* the buffer_site value.
* pDraw -> Will be assigned at the client side.
* buffer_site -> Software Buffers - DGA_SITE_SYSTEM
* Hardware Buffers - DGA_SITE_DEVICE
* fn -> shared of file name of the specified buffer.
* buffer_type -> Type of the buffer.
* sitechg -> Initialized to DGA_SITECHG_INITIAL when the
* buffer is created. When the buffer is getting
* reallocated, this will have DGA_SITECHG_CACHE.
* bitsPerPixel -> depth of the buffer
* bytesPerPixel-> (bitsPerPixel +7) >> 3
* width -> buffer width (Window's width)
* height -> buffer height (Window's height)
* linebytes -> ((bytesPerPixel * width) + 3) & ~3
* b_offset -> offset to data member from buffer address
* allocsize -> Shared file size.
* data -> Buffer data bits pointer.
* pad -> Padding to make sure it is 64-bit aligned, for now.
*/
typedef struct {
void *pDraw;
#else
void* pDraw;
int pad_pdraw;
#endif
int buffer_type;
int grab_cnt;
int width;
int height;
int bitsPerPixel;
int bytesPerPixel;
int linebytes;
int b_offset;
int allocsize;
#else
void* data;
#endif
typedef struct {
void *pDraw;
#else
int pad_bufferp;
void *pDraw;
int pad_pdraw;
#endif
int buf_size;
/* ABINFO: This structure contains buffer pointers and their
* respective filenames.
* s_modified -> Will be set to "1" when the buffer is resized.
* remap_flag -> This is used across server and client dga implementation
* buffer_swap -> swap counter.
*/
typedef struct wx_abinfo {
int s_modified;
int height;
#else
int pad_1_bufinfo;
int pad_2_bufinfo;
int pad_3_bufinfo;
int pad_4_bufinfo;
int pad_5_bufinfo;
#endif
int pad_pix;
#endif
int pad_tag;
#endif
int pad_vid;
#endif
int back_size;
int depth_size;
int stencil_size;
int accum_size;
int alpha_size;
} ABINFO;
typedef struct wx_winfo
{
/* VERSION 0 INFO STARTS HERE */
/* points to unlock page */
#else
/* points to unlock page */
#endif
/* server info, meaningless to client */
#else
#endif
/* client info */
#else
#endif
/* clipping info */
#else
#endif
/* shapes stuff */
/* VERSION 1 INFO STARTS HERE */
#endif
union {
struct {
#else
#endif
} vn;
struct {
short w_cliparray;
} v0;
} u;
/* VERSION 2 INFO STARTS HERE */
/* cursor grabber info */
#else
#endif
/* wid info */
struct {
/* integer version of window bounds */
struct {
/* db info */
#else
#endif
#else
#endif
/* VERSION 3 INFO STARTS HERE */
#endif
/*
* Attributes of multibuffer set
*
* Note: the number of buffers in an mbuf set is specified by
* wx_dbuf.number_buffers.
*/
#endif
/* VERSION 4 INFO STARTS HERE */
/* so the server knows to recalculate */
/* the overlay's opaque shape */
/* MPG_NONE => DGA_OVLSTATE_SAFE */
/* MPG_SAFE => DGA_OVLSTATE_SAFE */
/* MPG_SOFT => DGA_OVLSTATE_MULTIWID */
/* MPG_HARD => DGA_OVLSTATE_CONFLICT */
/* VERSION 5 INFO STARTS HERE */
#endif
#endif
int info_sz;
/*
* FLOATING INFO STARTS HERE, DO NOT REFER
* DIRECTLY TO ANYTHING BELOW THIS LINE.
*/
#if 0
char pad_abinfo[4];
#endif
#endif
short w_cliparray;
} WXINFO;
#endif /* _DGA_WINSHARED_H */