1/*
2 * Copyright (c) 1999-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _IOKIT_IOGRAPHICSLIB_H
25#define _IOKIT_IOGRAPHICSLIB_H
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <IOKit/IOKitLib.h>
32#include <IOKit/graphics/IOFramebufferShared.h>
33#include <IOKit/graphics/IOGraphicsInterface.h>
34
35/*! @header IOGraphicsLib
36IOGraphicsLib implements non-kernel task access to IOGraphics family object types - IOFramebuffer and IOAccelerator. These functions implement a graphics family specific API.<br>
37A connection to a graphics IOService must be made before these functions are called. A connection is made with the IOServiceOpen() function described in IOKitLib.h. An io_connect_t handle is returned by IOServiceOpen(), which must be passed to the IOGraphicsLib functions. The appropriate connection type from IOGraphicsTypes.h must be specified in the call to IOServiceOpen(). All of the IOFramebuffer functions can only be called from a kIOFBServerConnectType connection. Except as specified below, functions whose names begin with IOFB are IOFramebuffer functions. Functions whose names begin with IOPS are IOAccelerator functions and must be called from connections of type kIOFBEngineControllerConnectType or kIOFBEngineConnectType.<br>
38The functions in IOGraphicsLib use a number of special types. The display mode is the screen's resolution and refresh rate. The known display modes are referred to by an index of type IODisplayModeID. The display depth is the number of significant color bits used in representing each pixel. Depths are also referred to by an index value that is 0 for 8 bits, 1 for 15 bits, and 2 for 24 bits. A combination of display mode and depth may have a number of supported pixel formats. The pixel aperture is an index of supported pixel formats for a display mode and depth. This index is of type IOPixelAperture. All of these graphics specific types are defined in IOGraphicsTypes.h.
39*/
40/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
41
42extern kern_return_t
43IOFramebufferOpen(
44        io_service_t    service,
45        task_port_t     owningTask,
46        unsigned int    type,
47        io_connect_t  * connect );
48
49/*! @function IOFBCreateSharedCursor
50    @abstract Create shared cursor memory.
51    @discussion This function allocates memory, containing details about the cursor, that can be shared with a calling non-kernel task. The memory contains a StdFBShmem_t structure, which is defined in IOFrameBufferShared.h. This structure contains information on the cursor image, whether it is current shown, its location, etc. The allocated memory can be mapped to the non-kernel task's memory space by calling IOConnectMapMemory() and passing kIOFBCursorMemory for memoryType.
52    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
53    @param version The version of cursor shared memory to use. For the current version, pass kIOFBCurrentShmemVersion.
54    @param maxWidth The maximum width of the cursor.
55    @param maxHeight The maximum height of the cursor.
56    @result A kern_return_t error code. */
57
58extern kern_return_t
59IOFBCreateSharedCursor( io_connect_t connect,
60        unsigned int version,
61        unsigned int maxWidth, unsigned int maxHeight );
62
63/*! @function IOFBGetFramebufferInformationForAperture
64    @abstract Get framebuffer information for a pixel format.
65    @discussion This function returns framebuffer information for a pixel format that is supported for the current display mode and depth. The returned IOFrameBufferInformation structure contains details on the physical address of the framebuffer, height, width, etc. This structure is defined in IOGraphicsTypes.h.
66    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
67    @param aperture The pixel aperture to retrieve information on. The pixel aperture is an index into supported pixel formats for a display mode and depth. To get information for the current aperture, use kIOFBSystemAperture.
68    @param info A pointer to an IOFramebufferInformation structure where the information will be returned.
69    @result A kern_return_t error code. */
70
71extern kern_return_t
72IOFBGetFramebufferInformationForAperture( io_connect_t connect,
73            IOPixelAperture               aperture,
74            IOFramebufferInformation    * info );
75
76/*! @function IOFBGetFramebufferOffsetForAperture
77    @abstract Get the byte offset for a framebuffer's VRAM.
78    @discussion [place holder]
79    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
80    @param aperture The pixel aperture to retrieve information on. The pixel aperture is an index into supported pixel formats. To get information for the current aperture, use kIOFBSystemAperture.
81    @param offset The number of bytes offset is returned on success.
82    @result A kern_return_t error code. */
83
84extern kern_return_t
85IOFBGetFramebufferOffsetForAperture( mach_port_t connect,
86            IOPixelAperture               aperture,
87            IOByteCount                 * offset );
88
89/*! @function IOFBSetBounds
90    @abstract Set the location of the framebuffer within display space.
91    @discussion If there is more than one screen in use, the locations of the screens relative to each other must be specified. These locations are specified in a "display space" that encompasses all the screens. The bounding regions of the screens within display space indicate their location relative to each other as the cursor moves between them. This function sets the bounding region for a framebuffer within display space. If there is only one screen, this does not need to specified, because by default the screen coordinates and display space coordinates will be the same.
92    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
93    @param rect An IOGBounds structure specifying a rectangular region of the framebuffer.
94    @result A kern_return_t error code. */
95
96extern kern_return_t
97IOFBSetBounds( io_connect_t connect,
98            IOGBounds   * rect );
99
100/*!
101 * @function IOFBSetVirtualBounds
102 *
103 * @abstract
104 * Set the location of the framebuffer within display space and
105 * within desktop space.
106 *
107 * @param connect       The connect handle from <code>IOServiceOpen</code>
108 *                      to an IOFramebuffer service with a
109 *                      <code>kIOFBServerConnectType</code> connection.
110 * @param screenBounds  An <code>IOGBounds</code> structure specifying
111 *                      a rectangular region of the framebuffer
112 *                      in display space.
113 * @param desktopBounds An <code>IOGBounds</code> structure specifying
114 *                      a rectangular region of the framebuffer
115 *                      in desktop space.
116 * @result              A <code>kern_return_t</code> error code.
117 *
118 * @discussion
119 * If there is more than one screen in use, the locations of the screens relative
120 * to each other must be specified. Each physical screen will have a rectangular
121 * region of "display space" that it is responsible for showing. When the "display
122 * space" does not have a 1:1 mapping to the "desktop space" (e.g when using zooming,
123 * or HiDPI), this function is used to define how "desktop space" maps into "display
124 * space". Note that "desktop space" and "display space" should be contiguous, and
125 * the mapping between them should be functional (i.e. 1-to-1, though not necessarily
126 * contiguous).
127 */
128
129extern kern_return_t
130IOFBSetVirtualBounds(io_connect_t connect,
131                     IOGBounds   * screenBounds,
132                     IOGBounds   * desktopBounds );
133
134/*! @function IOFBGetCurrentDisplayModeAndDepth
135    @abstract Get the current display mode and depth.
136    @discussion The display mode index returned by this function can be used to determine information about the current display mode and its supported pixel formats through calls to IOFBGetDisplayModeInformation(), IOFBGetPixelFormats(), and IOFBGetPixelInformation().
137    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
138    @param displayMode The ID of the current display mode is returned.
139    @param depth The current display depth is returned (0 = 8 bits, 1 = 15 bits, 2 = 24 bits)
140    @result A kern_return_t error code. */
141
142extern kern_return_t
143IOFBGetCurrentDisplayModeAndDepth( io_connect_t connect,
144        IODisplayModeID * displayMode,
145        IOIndex         * depth );
146
147/*! @function IOFBGetPixelFormat
148    @abstract Get pixel format information.
149    @discussion Displayed colors are encoded in framebuffer memory in a variety of ways. IOFBGetPixelFormat returns a pixel encoding array specifying how each bit of a particular pixel should be interpreted. The definition of the IOPixelEncoding array returned and common Apple pixel formats are described in IOGraphicsTypes.h.
150    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
151    @param displayMode A display mode index.
152    @param depth A display depth index.
153    @param aperture The pixel aperture to retrieve the pixel format for. The pixel aperture is an index into supported pixel formats. To get information on the current aperture, use kIOFBSystemAperture.
154    @param pixelFormat The returned pixel format.
155    @result A kern_return_t error code. */
156
157extern kern_return_t
158IOFBGetPixelFormat( io_connect_t connect,
159        IODisplayModeID displayMode,
160        IOIndex         depth,
161        IOPixelAperture aperture,
162        IOPixelEncoding * pixelFormat );
163
164/*! @function IOFBSetCLUT
165    @abstract Set the color table.
166    @discussion Indexed pixel formats require a color table to convert from the index stored in a pixel memory location to a displayed color. IOFBSetCLUT sets one or more entries of the color table.
167    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
168    @param startIndex The first index to set in the color table.
169    @param numEntries The number of entries to set.
170    @param options kSetCLUTByValue may be set to use the index member of the IOColorEntry structure to determine where the entry should be written to the color table. Otherwise the index is taken from the location in the IOColorEntry array. kSetClutImmediately may be set to change the color table immediately instead of waiting for vertical blanking interval. kSetClubWithLuminance may be set to use luminance rather than RGB entries.
171    @param colors The array of color table entries to set. The IOColorEntry structure is defined in IOGraphicsTypes.h.
172    @result A kern_return_t error code. */
173
174extern kern_return_t
175IOFBSetCLUT( io_connect_t connect,
176        UInt32          startIndex,
177        UInt32          numEntries,
178        IOOptionBits    options,
179        IOColorEntry *  colors );
180
181/*! @function IOFBSetGamma
182    @abstract Set the gamma data.
183    @discussion [place holder]
184    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
185    @param channelCount
186    @param dataCount
187    @param dataWidth
188    @param data
189    @result A kern_return_t error code. */
190
191extern kern_return_t
192IOFBSetGamma( io_connect_t connect,
193        UInt32          channelCount,
194        UInt32          dataCount,
195        UInt32          dataWidth,
196        void *          data );
197
198/*! @function IOFBSet888To256Table
199    @abstract [place holder]
200    @discussion [place holder]
201    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
202    @param table
203    @result A kern_return_t error code. */
204
205extern kern_return_t
206IOFBSet888To256Table( io_connect_t connect,
207        const unsigned char *   table );
208
209/*! @function IOFBSet256To888Table
210    @abstract [place holder]
211    @discussion [place holder]
212    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
213    @param table
214    @result A kern_return_t error code. */
215
216extern kern_return_t
217IOFBSet256To888Table( io_connect_t connect,
218        const unsigned int *    table );
219
220/*! @function IOFBSet444To555Table
221    @abstract [place holder]
222    @discussion [place holder]
223    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
224    @param table
225    @result A kern_return_t error code. */
226
227extern kern_return_t
228IOFBSet444To555Table( io_connect_t connect,
229        const unsigned char *   table );
230
231/*! @function IOFBSet555To444Table
232    @abstract [place holder]
233    @discussion [place holder]
234    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
235    @param table
236    @result A kern_return_t error code. */
237
238extern kern_return_t
239IOFBSet555To444Table( io_connect_t connect,
240        const unsigned char *   table );
241
242// Array of supported display modes
243
244/*! @function IOFBGetDisplayModeCount
245    @abstract Get the number of display modes.
246    @discussion IOFBGetDisplayModeCount returns the number of display modes that the IOFramebuffer service is aware of.
247    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
248    @param count The display mode count is returned.
249    @result A kern_return_t error code. */
250
251kern_return_t
252IOFBGetDisplayModeCount( io_connect_t connect,
253        UInt32 * count );
254
255/*! @function IOFBGetDisplayModes
256    @abstract Get an array of known display modes.
257    @discussion This function returns an array containing the display modes that the framebuffer service is aware of. To get all display modes, pass the count from IOFBGetDisplayModeCount().
258    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
259    @param count The number of display modes to get.
260    @param allDisplayModes An array of IODisplayModeID's with enough space for all entries. The array is filled in upon return.
261    @result A kern_return_t error code. */
262
263kern_return_t
264IOFBGetDisplayModes( io_connect_t connect,
265        UInt32                  count,
266        IODisplayModeID *       allDisplayModes );
267
268// Info about a display mode
269
270/*! @function IOFBGetDisplayModeInformation
271    @abstract Get information about a display mode.
272    @discussion Display modes are referred to by their index of type IODisplayModeID. This function returns a structure containing the width, height, refresh rate, maximum depth, etc. of a display mode. The IODisplayModeInformation structure is defined in IOGraphicsTypes.h.
273    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
274    @param displayMode The display mode index.
275    @param info A pointer to an IODisplayModeInformation structure where the display mode information will be returned.
276    @result A kern_return_t error code. */
277
278kern_return_t
279IOFBGetDisplayModeInformation( io_connect_t connect,
280        IODisplayModeID         displayMode,
281        IODisplayModeInformation * info );
282
283
284// Mask of pixel formats available in mode and depth
285
286/*! @function IOFBGetPixelFormats
287    @abstract Get pixel formats that are supported for a display mode and depth.
288    @discussion This function returns a mask of all supported pixel formats for a particular display mode and depth. [How should the mask be interpreted?]
289    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
290    @param displayMode A display mode index.
291    @param depth A display depth index.
292    @param mask The returned mask of pixel formats.
293    @result A kern_return_t error code. */
294
295kern_return_t
296IOFBGetPixelFormats( io_connect_t connect,
297        IODisplayModeID         displayMode,
298        IOIndex                 depth,
299        UInt32 *                mask );
300
301/*! @function IOFBGetPixelInformation
302    @abstract Get information about a pixel format.
303    @discussion IOFBGetPixelInformation returns a structure containing information about a pixel format such as the bits per pixel, pixel format, etc. The IOPixelInformation structure is defined in IOGraphicsTypes.h.
304    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
305    @param displayMode A display mode index.
306    @param depth A display depth index.
307    @param aperture A pixel aperture. The pixel aperture is an index into supported pixel formats for a display mode and depth. To get information on the current aperture, use kIOFBSystemAperture.
308    @param pixelInfo A pointer to an IOPixelInformation structure where the pixel information will be returned.
309    @result A kern_return_t error code. */
310
311kern_return_t
312IOFBGetPixelInformation( io_connect_t connect,
313        IODisplayModeID         displayMode,
314        IOIndex                 depth,
315        IOPixelAperture         aperture,
316        IOPixelInformation *    pixelInfo );
317
318/*! @function IOFBSetDisplayModeAndDepth
319    @abstract Set the current display mode and depth.
320    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
321    @param displayMode The index of the new display mode.
322    @param depth The index of the new depth.
323    @result A kern_return_t error code. */
324
325kern_return_t
326IOFBSetDisplayModeAndDepth( io_connect_t connect,
327        IODisplayModeID         displayMode,
328        IOIndex                 depth );
329
330/*! @function IOFBSetStartupDisplayModeAndDepth
331    @abstract Set the display mode and depth to use on startup.
332    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
333    @param displayMode The index of the new display mode.
334    @param depth The index of the new depth.
335    @result A kern_return_t error code. */
336
337kern_return_t
338IOFBSetStartupDisplayModeAndDepth( io_connect_t connect,
339        IODisplayModeID         displayMode,
340        IOIndex                 depth );
341
342kern_return_t
343IOFBGetDefaultDisplayMode( io_connect_t connect,
344        IODisplayModeID * displayMode, IOIndex * displayDepth );
345
346/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
347
348struct IOFBMessageCallbacks {
349    IOReturn (*WillPowerOff)          (void * callbackRef, void * notificationID);
350    IOReturn (*DidPowerOn)            (void * callbackRef, void * notificationID);
351    IOReturn (*ConnectionChange)      (void * callbackRef, void * notificationID);
352    IOReturn (*WillPowerOffWithImages)(void * callbackRef, void * notificationID,
353				       uint32_t            imageCount,
354				       mach_vm_address_t * buffers,
355				       mach_vm_size_t *    bufferSizes);
356};
357typedef struct IOFBMessageCallbacks IOFBMessageCallbacks;
358
359#define IOFBMESSAGECALLBACKSVERSIONCURRENT 	2
360enum {
361    kIOFBMessageCallbacksVersionCurrent = IOFBMESSAGECALLBACKSVERSIONCURRENT,
362    IOFBMessageCallbacksVersion         = kIOFBMessageCallbacksVersionCurrent,
363};
364
365mach_port_t
366IOFBGetNotificationMachPort( io_connect_t connect );
367
368kern_return_t
369IOFBDispatchMessageNotification( io_connect_t connect, mach_msg_header_t * message,
370                                 UInt32 version, const IOFBMessageCallbacks * callbacks, void * callbackRef);
371
372kern_return_t
373IOFBAcknowledgeNotification( void * notificationID );
374
375enum {
376    kIOFBConnectStateOnline     = 0x00000001,
377    kIOFBConnectStateUnusable   = 0x00000002,
378    kIOFBConnectStateHWOnline   = 0x00000004
379};
380
381kern_return_t
382IOFBGetConnectState( io_connect_t connect, IOOptionBits * state );
383
384kern_return_t
385IOFBGetAttributeForFramebuffer( io_connect_t connect, io_connect_t otherConnect,
386                                IOSelect attribute, UInt32 * value );
387kern_return_t
388IOFBSetAttributeForFramebuffer( io_connect_t connect, io_connect_t otherConnect,
389                                IOSelect attribute, UInt32 value );
390
391/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
392
393/*! @function IOFBCreateDisplayModeDictionary
394    @abstract Create a CFDictionary with information about a display mode.
395    @discussion This function creates a dictionary containing information about a display mode. The display mode properties that are represented by the kernel as OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, or OSBoolean are converted to their CF counterparts and put in the dictionary.
396    @param framebuffer The IOService handle for an IOFramebuffer service.
397    @param displayMode A display mode index.
398    @result The returned CFDictionary that should be released by the caller with CFRelease(). */
399
400CFDictionaryRef
401IOFBCreateDisplayModeDictionary(
402        io_service_t            framebuffer,
403        IODisplayModeID         displayMode );
404
405/*! @function IOFBGetPixelInfoDictionary
406    @abstract Get a CFDictionary with information about a pixel format.
407    @discussion This function extracts a CFDictionary containing information about a supported pixel format from a larger CFDictionary describing a display mode. IOFBCreateDisplayModeDictionary() must be called first to generate the CFDictionary for a display mode.
408    @param modeDictionary The CFDictionary containing information about a display mode.
409    @param depth A depth index.
410    @param aperture The pixel aperture to information about. The pixel aperture is an index into supported pixel formats. To get information on the current aperture, use kIOFBSystemAperture.
411    @result The returned CFDictionary that should be released by the caller with CFRelease(). */
412
413CFDictionaryRef
414IOFBGetPixelInfoDictionary(
415        CFDictionaryRef         modeDictionary,
416        IOIndex                 depth,
417        IOPixelAperture         aperture );
418
419/*! @enum IODisplayDictionaryOptions
420    @constant kIODisplayMatchingInfo Include only the keys necessary to match two displays with IODisplayMatchDictionaries().
421    @constant kIODisplayOnlyPreferredName The kDisplayProductName property includes only the localized names returned by CFBundleCopyPreferredLocalizationsFromArray().
422    @constant kIODisplayNoProductName The kDisplayProductName property is not included in the returned dictionary.
423*/
424enum {
425    kIODisplayMatchingInfo      = 0x00000100,
426    kIODisplayOnlyPreferredName = 0x00000200,
427    kIODisplayNoProductName     = 0x00000400
428};
429
430/*! @function IODisplayCreateInfoDictionary
431    @abstract Create a CFDictionary with information about display hardware.
432    @discussion The CFDictionary created by this function contains information about the display hardware associated with a framebuffer. The keys for the dictionary are listed in IOGraphicsTypes.h.
433    @param framebuffer The IOService handle for an IOFramebuffer service.
434    @param options Use IODisplayDictionaryOptions to specify which keys to include.
435    @result The returned CFDictionary that should be released by the caller with CFRelease(). */
436
437CFDictionaryRef
438IODisplayCreateInfoDictionary(
439        io_service_t            framebuffer,
440        IOOptionBits            options );
441
442/*! @defined IOCreateDisplayInfoDictionary
443    @discussion IOCreateDisplayInfoDictionary() was renamed IODisplayCreateInfoDictionary(). IOCreateDisplayInfoDictionary() is now a macro for IODisplayCreateInfoDictionary() for compatibility with older code. */
444
445#define IOCreateDisplayInfoDictionary(f,o)      \
446        IODisplayCreateInfoDictionary(f,o)
447
448/*! @function IODisplayMatchDictionaries
449    @abstract Match two display information dictionaries to see if they are for the same display.
450    @discussion By comparing two CFDictionaries returned from IODisplayCreateInfoDictionary(), this function determines if the displays are the same. The information compared is what is returned by calling IODisplayCreateInfoDictionary() with an option of kIODisplayMatchingInfo. This includes information such as the vendor, product, and serial number.
451    @param matching1 A CFDictionary returned from IODisplayCreateInfoDictionary().
452    @param matching2 Another CFDictionary returned from IODisplayCreateInfoDictionary().
453    @param options No options are currently defined.
454    @result Returns FALSE if the two displays are not equivalent or TRUE if they are. */
455
456SInt32
457IODisplayMatchDictionaries(
458        CFDictionaryRef         matching1,
459        CFDictionaryRef         matching2,
460        IOOptionBits            options );
461
462/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
463
464io_service_t
465IODisplayForFramebuffer(
466        io_service_t    framebuffer,
467        IOOptionBits    options );
468
469IOReturn
470IODisplaySetParameters(
471        io_service_t    service,
472        IOOptionBits    options,
473        CFDictionaryRef params );
474
475IOReturn
476IODisplaySetFloatParameter(
477        io_service_t    service,
478        IOOptionBits    options,
479        CFStringRef     parameterName,
480        float           value );
481IOReturn
482IODisplaySetIntegerParameter(
483        io_service_t    service,
484        IOOptionBits    options,
485        CFStringRef     parameterName,
486        SInt32          value );
487
488IOReturn
489IODisplayCopyParameters(
490        io_service_t      service,
491        IOOptionBits      options,
492        CFDictionaryRef * params );
493
494IOReturn
495IODisplayCopyFloatParameters(
496        io_service_t      service,
497        IOOptionBits      options,
498        CFDictionaryRef * params );
499
500IOReturn
501IODisplayGetFloatParameter(
502        io_service_t    service,
503        IOOptionBits    options,
504        CFStringRef     parameterName,
505        float *         value );
506
507IOReturn
508IODisplayGetIntegerRangeParameter(
509        io_service_t    service,
510        IOOptionBits    options,
511        CFStringRef     parameterName,
512        SInt32 *        value,
513        SInt32 *        min,
514        SInt32 *        max );
515
516IOReturn
517IODisplayCommitParameters(
518        io_service_t    service,
519        IOOptionBits    options );
520
521/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
522
523/*! @function IOFBSetNewCursor
524    @abstract Set a new hardware cursor.
525    @discussion A non-kernel task interacts with the IOFramebuffer service through a slice of shared memory that is created with the IOFBCreateSharedCursor function. The shared memory is a structure of type StdFBShmem_t. In this shared memory several cursor images, or frames may be defined. The maximum number of frames is kIOFBNumCursorFrames. StdFBShmem_t and kIOFBNumCursorFrames are defined in IOFramebufferShared.h. This function sets a new frame to be used as the current cursor image and activates the hardware cursor.
526    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
527    @param cursor This parameter is currently not used and must be 0.
528    @param frame An index to the cursor image to use that must be less than kIOFBNumCursorFrames. Currently only frame 0 is supported.
529    @param options No options are currently defined.
530    @result A kern_return_t error code. */
531
532kern_return_t
533IOFBSetNewCursor( io_connect_t connect,
534        void *                  cursor,
535        IOIndex                 frame,
536        IOOptionBits            options );
537
538/*! @function IOFBSetCursorVisible
539    @abstract Set the hardware cursor visible or invisible.
540    @discussion The hardware cursor can only be set visible or invisible when it is active. Use IOFBSetNewCursor() to activate the hardware cursor.
541    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
542    @param visible TRUE to make the cursor visible and FALSE to make it invisible.
543    @result A kern_return_t error code. */
544
545kern_return_t
546IOFBSetCursorVisible( io_connect_t connect,
547        int                     visible );
548
549/*! @function IOFBSetCursorPosition
550    @abstract Set the hardware cursor position.
551    @discussion This function only works with the hardware cursor and will fail if a hardware cursor is not supported.
552    @param connect The connect handle from IOServiceOpen() to an IOFramebuffer service with a kIOFBServerConnectType connection.
553    @param x The x coordinate.
554    @param y The y coordinate.
555    @result A kern_return_t error code. */
556
557kern_return_t
558IOFBSetCursorPosition( io_connect_t connect,
559        long int                x,
560        long int                y );
561
562/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
563
564kern_return_t
565IOFBAcknowledgePM( io_connect_t connect );
566
567/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
568
569kern_return_t
570IOPSAllocateBlitEngine( io_connect_t framebuffer,
571                void ** blitterRef, int * quality);
572
573kern_return_t
574IOPSBlitReset( void * blitterRef);
575
576kern_return_t
577IOPSBlitDeallocate( void * blitterRef);
578
579kern_return_t
580IOPSBlitIdle( void * blitterRef);
581
582kern_return_t
583IOPSBlitFill( void * blitterRef,
584                int dst_x, int dst_y, int width, int height, int data );
585
586kern_return_t
587IOPSBlitCopy( void * blitterRef,
588                int src_x, int src_y, int width, int height,
589                int dst_x, int dst_y );
590
591kern_return_t
592IOPSBlitInvert( void * blitterRef,
593                int x, int y, int w, int h );
594
595enum {
596    // options for IOFBSynchronize
597    kIOFBSynchronizeWaitBeamExit        = kIOBlitSynchronizeWaitBeamExit,
598    kIOFBSynchronizeFlushWrites         = kIOBlitSynchronizeFlushHostWrites
599};
600
601enum {
602    // options for IOFBBlitVRAMCopy
603    kIOFBBlitBeamSync                   = kIOBlitBeamSync,
604    kIOFBBlitBeamSyncAlways             = kIOBlitBeamSyncAlways,
605    kIOFBBlitBeamSyncSpin               = kIOBlitBeamSyncSpin
606};
607
608kern_return_t
609IOFBBlitVRAMCopy( void * blitterRef,
610                int src_x, int src_y, int width, int height,
611                int dst_x, int dst_y, IOOptionBits options );
612
613kern_return_t
614IOFBBlitSurfaceCopy( void * blitterRef, IOOptionBits options, void * surfaceID,
615                     IOAccelDeviceRegion * region, UInt32 surfaceX, UInt32 surfaceY );
616
617kern_return_t
618IOFBBlitSurfaceSurfaceCopy( void * blitterRef, IOOptionBits options,
619                            void * sourceSurfaceID, void * destSurfaceID,
620                            IOAccelDeviceRegion * region, UInt32 surfaceX, UInt32 surfaceY );
621
622kern_return_t
623IOFBSynchronize( void * blitterRef,
624                 UInt32 x, UInt32 y, UInt32 w, UInt32 h, UInt32 options );
625
626kern_return_t
627IOFBBeamPosition( void * blitterRef, UInt32 options, SInt32 * position );
628
629kern_return_t
630IOFBSetupFIFOBurst( void * blitterRef,
631                        UInt32 x, UInt32 y, UInt32 w, UInt32 h,
632                        UInt32 options, void ** burstRef );
633
634void
635IOFBBurstWrite32( void * p1, void * p2, void * p3, void * p4,
636                  void * p5, void * p6, void * p7, void * p8 );
637
638void
639IOFBSetBurstRef( void * burstRef );
640
641kern_return_t
642IOFBCommitMemory( void * blitterRef,
643                vm_address_t start, vm_size_t length, IOOptionBits options,
644                void ** memoryRef, IOByteCount * offset );
645
646kern_return_t
647IOFBReleaseMemory( void * blitterRef, void * memoryRef );
648
649kern_return_t
650IOFBWaitForCompletion( void * blitterRef, SInt32 token );
651
652kern_return_t
653IOFBMemoryCopy( void * blitterRef,
654                        UInt32 destLeft, UInt32 destTop,
655                        UInt32 width, UInt32 height,
656                        UInt32 srcByteOffset, UInt32 srcRowBytes,
657                        SInt32 * token);
658
659/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
660
661#ifdef __cplusplus
662}
663#endif
664
665#endif /* ! _IOKIT_IOGRAPHICSLIB_H */
666
667