Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/graphics/IOFramebufferShared.h

1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _IOKIT_IOFRAMEBUFFERSHARED_H
24#define _IOKIT_IOFRAMEBUFFERSHARED_H
25
26#include <IOKit/hidsystem/IOHIDTypes.h>
27#include <IOKit/graphics/IOGraphicsTypes.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/*! @header IOFramebufferShared
34The IOFramebufferShared.h header contains definitions of objects and types shared between a kernel level IOFrameBuffer service and a non-kernel window server. In Mac OS X this structure is used by the CoreGraphics server and IOGraphics Family, and is not available to other clients. IOFramebuffer subclasses and IOFramebuffer clients within the kernel should also not rely on this structure definition and constants. It is public only for use on Darwin based window servers. Cursor and window server state data is exchanged by kernel and non-kernel tasks through a slice of shared memory containing a StdFBShmem_t structure.<br>
35For a non-kernel task to get access to this slice of shared memory, a connection to an IOFramebuffer service must be made. A connection is made with the IOServiceOpen() function described in IOKitLib.h. A connection type of kIOFBServerConnectType or kIOFBSharedConnectType (for read-only access) should be specified. An io_connect_t handle is returned by IOServiceOpen(). This handle must be passed to IOFBCreateSharedCursor() to create the slice of shared memory. Then IOConnectMapMemory() may be called with a memory type of kIOFBCursorMemory to map the shared memory into the non-kernel task.
36*/
37
38#ifdef KERNEL
39// CGS use optional
40/*! @defined IOFB_ARBITRARY_SIZE_CURSOR
41 @discussion When IOFB_ARBITRARY_SIZE_CURSOR is not defined, the maximum cursor size is assumed to be CURSORWIDTH x CURSORHEIGHT and this header file will define a number of structures for storing cursor images accordingly. A non-kernel task may define IOFB_ARBITRARY_SIZE_CURSOR and use cursors up to the size specified when IOFBCreateSharedCursor() was called. In this case appropriate structures for storing cursor images must be defined elsewhere. In the kernel, IOFB_ARBITRARY_SIZE_CURSOR is always defined.
42*/
43#define IOFB_ARBITRARY_SIZE_CURSOR
44#define IOFB_ARBITRARY_FRAMES_CURSOR 1
45#endif
46
47#define IOFB_SUPPORTS_XOR_CURSOR
48#define IOFB_SUPPORTS_HW_SHIELD
49#define IOFB_SUPPORTS_ARBITRARY_FRAMES_CURSOR
50
51//
52// Cursor and Window Server state data, occupying a slice of shared memory
53// between the kernel and WindowServer.
54//
55/*! @enum CursorParameters
56 @constant kIOFBNumCursorFrames The number of cursor images stored in the StdFBShmem_t structure.
57 @constant kIOFBNumCursorFramesShift Used with waiting cursors.
58 @constant kIOFBMaxCursorDepth The maximum cursor pixel depth.
59*/
60enum {
61#if IOFB_ARBITRARY_FRAMES_CURSOR
62 kIOFBMainCursorIndex = 0,
63 kIOFBWaitCursorIndex = 1,
64 kIOFBNumCursorIndex = 4,
65#else
66 kIOFBNumCursorFrames = 4,
67 kIOFBNumCursorFramesShift = 2,
68#endif
69 kIOFBMaxCursorDepth = 32
70};
71
72#ifndef IOFB_ARBITRARY_SIZE_CURSOR
73
74/*! @defined CURSORWIDTH
75 @discussion The maximum width of the cursor image in pixels. This is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
76*/
77#define CURSORWIDTH 16 /* width in pixels */
78
79/*! @defined CURSORHEIGHT
80 @discussion The maximum height of the cursor image in pixels. This is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
81*/
82#define CURSORHEIGHT 16 /* height in pixels */
83
84/*! @struct bm12Cursor
85 @abstract Cursor image for 1-bit cursor.
86 @discussion This structure stores 16 pixel x 16 pixel cursors to be used with 1-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
87 @field image This array contains the cursor images.
88 @field mask This array contains the cursor mask.
89 @field save This array stores the pixel values of the region underneath the cursor in its last drawn position.
90*/
91struct bm12Cursor {
92 unsigned int image[4][16];
93 unsigned int mask[4][16];
94 unsigned int save[16];
95};
96
97/*! @struct bm18Cursor
98 @abstract Cursor image for 8-bit cursor.
99 @discussion This structure stores 16 pixel x 16 pixel cursors to be used with 8-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
100 @field image This array contains cursor color values, which are converted to displayed colors through the color table. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel.
101 @field mask This array contains the cursor alpha mask. The array is two dimensional with the same indexing as the image. If an alpha mask pixel is 0 and the corresponding image pixel is set to white for the display, then this cursor pixel will invert pixels on the display.
102 @field save This array stores the color values of the region underneath the cursor in its last drawn position.
103*/
104struct bm18Cursor {
105 unsigned char image[4][256];
106 unsigned char mask[4][256];
107 unsigned char save[256];
108};
109
110/*! @struct bm34Cursor
111 @abstract Cursor image for 15-bit cursor.
112 @discussion This structure stores 16 pixel x 16 pixel cursors to be used with 15-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
113 @field image This array defines the cursor color values and transparency. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel. A value of 0 means the pixel is transparent. Non-zero values are stored with the red, green, blue, and alpha values encoded with the following masks:<BR>
114 red mask = 0xF000<br>
115 blue mask 0x0F00<br>
116 green mask 0x00F0<br>
117 alpha mask = 0x000F<br>
118Note, only 4 bits are allocated for each color component.
119 @field save This array stores the color values of the region underneath the cursor in its last drawn position.
120*/
121struct bm34Cursor {
122 unsigned short image[4][256];
123 unsigned short save[256];
124};
125
126/*! @struct bm38Cursor
127 @abstract Cursor image for 24-bit cursor.
128 @discussion This structure stores 16 pixel x 16 pixel cursors to be used with 24-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
129 @field image This array defines the cursor color values and transparency. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel. The lower 24 bits of a pixel's value contain the RGB color, while the upper 8 bits contain the alpha value.
130 @field save This array stores the color values of the region underneath the cursor in its last drawn position.
131*/
132struct bm38Cursor {
133 unsigned int image[4][256];
134 unsigned int save[256];
135};
136
137#endif /* IOFB_ARBITRARY_SIZE_CURSOR */
138
139enum {
140 kIOFBCursorImageNew = 0x01,
141 kIOFBCursorHWCapable = 0x02
142};
143enum {
144 kIOFBHardwareCursorActive = 0x01,
145 kIOFBHardwareCursorInVRAM = 0x02
146};
147
148/*! @struct StdFBShmem_t
149 @discussion This structure contains cursor and window server state data and occupies a slice of shared memory between the kernel and window server. Several elements of this structure are only used in software cursor mode. Unless otherwise indicated, the coordinates in this structure are given in display space. Display space is the coordinate space that encompasses all the screens. The positions of the screens within display space indicate their location relative to each other as the cursor moves between them. If there is only one screen, the screen coordinates and display space coordinates will be the same.
150 @field cursorSema Semaphore lock for write access to the shared data in this structure.
151 @field frame The current cursor frame index.
152 @field cursorShow The cursor is displayed when cursorShow is 0.
153 @field cursorObscured If this is true, the cursor has been obscured and cursorShow should not be 0. The cursor will be shown again the next time it is moved.
154 @field shieldFlag When this is set to true the cursor will not be displayed in the region specified by shieldRect.
155 @field shielded True if the cursor has been hidden because it entered the shielded region.
156 @field saveRect The region that is saved underneath the cursor in software cursor mode.
157 @field shieldRect The region that the cursor will not be displayed in if shieldFlag is true.
158 @field cursorLoc The location of the cursor hot spot.
159 @field cursorRect The region that the cursor image currently occupies in software cursor mode.
160 @field oldCursorRect The region that the cursor image occupied the last time the cursor was drawn in software cursor mode.
161 @field screenBounds The region that the current screen occupies.
162 @field version Contains kIOFBCurrentShmemVersion so that a user client can ensure it is using the same version of this structure as the kernel.
163 @field structSize Contains the size of this structure.
164 @field vblTime The time of the most recent vertical blanking.
165 @field vblDelta The interval between the two most recent vertical blankings.
166 @field vblCount A running count of vertical blank interrupts.
167 @field reservedC Reserved for future use.
168 @field hardwareCursorCapable True if the hardware is capable of using hardware cursor mode.
169 @field hardwareCursorActive True if currently using the hardware cursor mode.
170 @field reservedB Reserved for future use.
171 @field cursorSize This array contains the cursor sizes indexed by frame.
172 @field hotSpot This array contains the location of the cursor hot spots indexed by frame. The hot spots coordinates are given relative to the top left corner of the cursor image.
173 @field cursor A union of structures that define the cursor images. The structure used depends on the framebuffer's bit depth. These structures are defined above.
174*/
175
176struct StdFBShmem_t {
177 ev_lock_data_t cursorSema;
178 int frame;
179 char cursorShow;
180 char cursorObscured;
181 char shieldFlag;
182 char shielded;
183 IOGBounds saveRect;
184 IOGBounds shieldRect;
185 IOGPoint cursorLoc;
186 IOGBounds cursorRect;
187 IOGBounds oldCursorRect;
188 IOGBounds screenBounds;
189 int version;
190 int structSize;
191 AbsoluteTime vblTime;
192 AbsoluteTime vblDelta;
193 unsigned long long int vblCount;
194#if IOFB_ARBITRARY_FRAMES_CURSOR
195 unsigned int reservedC[28];
196#else
197 unsigned int reservedC[27];
198 unsigned char hardwareCursorFlags[kIOFBNumCursorFrames];
199#endif
200 unsigned char hardwareCursorCapable;
201 unsigned char hardwareCursorActive;
202 unsigned char hardwareCursorShields;
203 unsigned char reservedB[1];
204#if IOFB_ARBITRARY_FRAMES_CURSOR
205 IOGSize cursorSize[kIOFBNumCursorIndex];
206 IOGPoint hotSpot[kIOFBNumCursorIndex];
207#else
208 IOGSize cursorSize[kIOFBNumCursorFrames];
209 IOGPoint hotSpot[kIOFBNumCursorFrames];
210#endif
211#ifndef IOFB_ARBITRARY_SIZE_CURSOR
212 union {
213 struct bm12Cursor bw;
214 struct bm18Cursor bw8;
215 struct bm34Cursor rgb;
216 struct bm38Cursor rgb24;
217 } cursor;
218#else /* IOFB_ARBITRARY_SIZE_CURSOR */
219 unsigned char cursor[0];
220#endif /* IOFB_ARBITRARY_SIZE_CURSOR */
221};
222#ifndef __cplusplus
223typedef volatile struct StdFBShmem_t StdFBShmem_t;
224#endif
225
226
227/*! @enum FramebufferConstants
228 @constant kIOFBCurrentShmemVersion The current version of the slice of shared memory that contains the cursor and window server state data in the StdFBShmem_t structure.
229 @constant kIOFBCursorMemory The memory type for IOConnectMapMemory() to get a slice of shared memory that contains the StdFBShmem_t structure.
230*/
231enum {
232 // version for IOFBCreateSharedCursor
233 kIOFBShmemVersionMask = 0x000000ff,
234 kIOFBTenPtOneShmemVersion = 2,
235 kIOFBTenPtTwoShmemVersion = 3,
236 kIOFBCurrentShmemVersion = 2,
237
238 // number of frames in animating cursor (if > kIOFBTenPtTwoShmemVersion)
239 kIOFBShmemCursorNumFramesMask = 0x00ff0000,
240 kIOFBShmemCursorNumFramesShift = 16,
241
242 // memory types for IOConnectMapMemory.
243 kIOFBCursorMemory = 100
244};
245
246/*! @defined IOFRAMEBUFFER_CONFORMSTO
247 @discussion The class name of the framebuffer service.
248*/
249#define IOFRAMEBUFFER_CONFORMSTO "IOFramebuffer"
250
251#ifdef __cplusplus
252}
253#endif
254
255#endif /* ! _IOKIT_IOFRAMEBUFFERSHARED_H */
256

Archive Download this file

Revision: 2225