#ifndef _IOKIT_IOFRAMEBUFFER_H
#define _IOKIT_IOFRAMEBUFFER_H
#include <IOKit/IOService.h>
#include <IOKit/graphics/IOGraphicsDevice.h>
#include <IOKit/graphics/IOFramebufferShared.h>
#include <IOKit/IOLib.h>
class IOFramebuffer;
class IOBufferMemoryDescriptor;
typedef void (*CursorBlitProc)(
IOFramebuffer * inst,
void * shmem,
volatile unsigned char *vramPtr,
unsigned int cursStart,
unsigned int vramRow,
unsigned int cursRow,
int width,
int height );
typedef void (*CursorRemoveProc)(
IOFramebuffer * inst,
void * shmem,
volatile unsigned char *vramPtr,
unsigned int vramRow,
int width,
int height );
enum {
kTransparentEncoding = 0,
kInvertingEncoding
};
enum {
kTransparentEncodingShift = (kTransparentEncoding << 1),
kTransparentEncodedPixel = (0x01 << kTransparentEncodingShift),
kInvertingEncodingShift = (kInvertingEncoding << 1),
kInvertingEncodedPixel = (0x01 << kInvertingEncodingShift),
};
enum {
kHardwareCursorDescriptorMajorVersion = 0x0001,
kHardwareCursorDescriptorMinorVersion = 0x0000
};
struct IOHardwareCursorDescriptor {
UInt16 majorVersion;
UInt16 minorVersion;
UInt32 height;
UInt32 width;
UInt32 bitDepth;
UInt32 maskBitDepth;
UInt32 numColors;
UInt32 * colorEncodings;
UInt32 flags;
UInt32 supportedSpecialEncodings;
UInt32 specialEncodings[16];
};
typedef struct IOHardwareCursorDescriptor IOHardwareCursorDescriptor;
enum {
kHardwareCursorInfoMajorVersion = 0x0001,
kHardwareCursorInfoMinorVersion = 0x0000
};
struct IOHardwareCursorInfo {
UInt16 majorVersion;
UInt16 minorVersion;
UInt32 cursorHeight;
UInt32 cursorWidth;
IOColorEntry * colorMap;
UInt8 * hardwareCursorData;
UInt32 reserved[6];
};
typedef struct IOHardwareCursorInfo IOHardwareCursorInfo;
enum {
kIODDCLow = 0,
kIODDCHigh = 1,
kIODDCTristate = 2
};
enum {
kIODDCBlockTypeEDID = 0
};
enum {
kIODDCForceRead = 0x00000001,
};
enum {
kDisabledInterruptState = 0,
kEnabledInterruptState = 1
};
typedef void (*IOFBInterruptProc)( OSObject * target, void * ref );
typedef IOReturn (*IOFramebufferNotificationHandler)
(OSObject * self, void * ref,
IOFramebuffer * framebuffer, IOIndex event,
void * info);
enum {
kIOFBNotifyDisplayModeWillChange = 1,
kIOFBNotifyDisplayModeDidChange,
kIOFBNotifyWillSleep,
kIOFBNotifyDidWake,
};
struct StdFBShmem_t;
class IOFramebufferUserClient;
class IOFramebuffer : public IOGraphicsDevice
{
friend class IOFramebufferUserClient;
friend class IOFramebufferSharedUserClient;
friend class IOGraphicsEngineClient;
OSDeclareDefaultStructors(IOFramebuffer)
protected:
struct ExpansionData { };
ExpansionData * reserved;
private:
protected:
StdFBShmem_t * priv;
int shmemClientVersion;
IOBufferMemoryDescriptor * sharedCursor;
union {
struct {
unsigned char * _bm34To35SampleTable;
unsigned char * _bm35To34SampleTable;
unsigned int * _bm256To38SampleTable;
unsigned char * _bm38To256SampleTable;
} t;
UInt8 * tables[ 4 ];
} colorConvert;
CursorBlitProc cursorBlitProc;
CursorRemoveProc cursorRemoveProc;
IOGSize maxCursorSize;
volatile unsigned char * cursorImages[ kIOFBNumCursorFrames ];
volatile unsigned char * cursorMasks[ kIOFBNumCursorFrames ];
volatile unsigned char * cursorSave;
unsigned int white;
Point nextCursorLoc;
int nextCursorFrame;
void * vblInterrupt;
semaphore_t vblSemaphore;
volatile unsigned char * frameBuffer;
unsigned int totalWidth;
unsigned int rowBytes;
unsigned int bytesPerPixel;
IOMemoryMap * vramMap;
IOByteCount vramMapOffset;
OSArray * userAccessRanges;
OSArray * engineAccessRanges;
IOBufferMemoryDescriptor * engineContext;
OSSet * fbNotifications;
class IOFramebufferUserClient * serverConnect;
class IOFramebufferSharedUserClient * sharedConnect;
bool opened;
bool closed;
bool clutValid;
bool currentMono;
bool needCursorService;
bool haveVBLService;
bool haveHWCursor;
bool hwCursorLoaded;
void * pmRef;
int _IOFramebuffer_reserved[7];
private:
OSMetaClassDeclareReservedUnused(IOFramebuffer, 0);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 1);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 2);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 3);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 4);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 5);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 6);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 7);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 8);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 9);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 10);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 11);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 12);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 13);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 14);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 15);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 16);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 17);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 18);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 19);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 20);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 21);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 22);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 23);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 24);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 25);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 26);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 27);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 28);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 29);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 30);
OSMetaClassDeclareReservedUnused(IOFramebuffer, 31);
public:
static void initialize();
virtual IOReturn powerStateWillChangeTo ( IOPMPowerFlags, unsigned long, IOService* );
virtual IOReturn powerStateDidChangeTo ( IOPMPowerFlags, unsigned long, IOService* );
virtual IOReturn setPowerState( unsigned long powerStateOrdinal, IOService * device);
virtual IOReturn newUserClient( task_t owningTask,
void * security_id,
UInt32 type,
IOUserClient ** handler );
virtual void hideCursor( void );
virtual void showCursor( Point * cursorLoc, int frame );
virtual void moveCursor( Point * cursorLoc, int frame );
void resetCursor( void );
virtual void getVBLTime( AbsoluteTime * time, AbsoluteTime * delta );
virtual void getBoundingRect ( Bounds ** bounds );
virtual bool start( IOService * provider );
virtual IOReturn open( void );
virtual void close( void );
virtual bool isConsoleDevice( void );
virtual IOReturn setupForCurrentConfig( void );
virtual bool serializeInfo( OSSerialize * s );
virtual bool setNumber( OSDictionary * dict, const char * key,
UInt32 number );
IONotifier * addFramebufferNotification(
IOFramebufferNotificationHandler handler,
OSObject * self, void * ref);
virtual IODeviceMemory * getApertureRange( IOPixelAperture aperture ) = 0;
virtual IODeviceMemory * getVRAMRange( void );
protected:
IOReturn deliverFramebufferNotification(
IOIndex event, void * info = 0 );
#ifdef IOFRAMEBUFFER_PRIVATE
#include <IOKit/graphics/IOFramebufferPrivate.h>
#endif
public:
virtual IOReturn enableController( void );
virtual const char * getPixelFormats( void ) = 0;
virtual IOItemCount getDisplayModeCount( void ) = 0;
virtual IOReturn getDisplayModes( IODisplayModeID * allDisplayModes ) = 0;
virtual IOReturn getInformationForDisplayMode( IODisplayModeID displayMode,
IODisplayModeInformation * info ) = 0;
virtual UInt64 getPixelFormatsForDisplayMode( IODisplayModeID displayMode,
IOIndex depth ) = 0;
virtual IOReturn getPixelInformation(
IODisplayModeID displayMode, IOIndex depth,
IOPixelAperture aperture, IOPixelInformation * pixelInfo ) = 0;
virtual IOReturn getCurrentDisplayMode( IODisplayModeID * displayMode,
IOIndex * depth ) = 0;
virtual IOReturn setDisplayMode( IODisplayModeID displayMode,
IOIndex depth );
virtual IOReturn setApertureEnable( IOPixelAperture aperture,
IOOptionBits enable );
virtual IOReturn setStartupDisplayMode( IODisplayModeID displayMode,
IOIndex depth );
virtual IOReturn getStartupDisplayMode( IODisplayModeID * displayMode,
IOIndex * depth );
virtual IOReturn setCLUTWithEntries( IOColorEntry * colors, UInt32 index,
UInt32 numEntries, IOOptionBits options );
virtual IOReturn setGammaTable( UInt32 channelCount, UInt32 dataCount,
UInt32 dataWidth, void * data );
virtual IOReturn setAttribute( IOSelect attribute, UInt32 value );
virtual IOReturn getAttribute( IOSelect attribute, UInt32 * value );
virtual IOReturn getTimingInfoForDisplayMode(
IODisplayModeID displayMode, IOTimingInformation * info );
virtual IOReturn validateDetailedTiming(
void * description, IOByteCount descripSize );
virtual IOReturn setDetailedTimings( OSArray * array );
virtual IOItemCount getConnectionCount( void );
virtual IOReturn setAttributeForConnection( IOIndex connectIndex,
IOSelect attribute, UInt32 value );
virtual IOReturn getAttributeForConnection( IOIndex connectIndex,
IOSelect attribute, UInt32 * value );
virtual bool convertCursorImage( void * cursorImage,
IOHardwareCursorDescriptor * description,
IOHardwareCursorInfo * cursor );
virtual IOReturn setCursorImage( void * cursorImage );
virtual IOReturn setCursorState( SInt32 x, SInt32 y, bool visible );
virtual void flushCursor( void );
virtual IOReturn getAppleSense( IOIndex connectIndex,
UInt32 * senseType,
UInt32 * primary,
UInt32 * extended,
UInt32 * displayType );
virtual IOReturn connectFlags( IOIndex connectIndex,
IODisplayModeID displayMode, IOOptionBits * flags );
virtual void setDDCClock( IOIndex connectIndex, UInt32 value );
virtual void setDDCData( IOIndex connectIndex, UInt32 value );
virtual bool readDDCClock( IOIndex connectIndex );
virtual bool readDDCData( IOIndex connectIndex );
virtual IOReturn enableDDCRaster( bool enable );
virtual bool hasDDCConnect( IOIndex connectIndex );
virtual IOReturn getDDCBlock( IOIndex connectIndex, UInt32 blockNumber,
IOSelect blockType, IOOptionBits options,
UInt8 * data, IOByteCount * length );
virtual IOReturn registerForInterruptType( IOSelect interruptType,
IOFBInterruptProc proc, OSObject * target, void * ref,
void ** interruptRef );
virtual IOReturn unregisterInterrupt( void * interruptRef );
virtual IOReturn setInterruptState( void * interruptRef, UInt32 state );
virtual IOReturn getNotificationSemaphore( IOSelect interruptType,
semaphore_t * semaphore );
};
#endif