1 /* 2 * Copyright 2007-2012 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Gerald Zajac 7 */ 8 #ifndef _ACCELERANT_H 9 #define _ACCELERANT_H 10 11 12 #include "DriverInterface.h" 13 14 15 #undef TRACE 16 17 #ifdef ENABLE_DEBUG_TRACE 18 extern "C" void _sPrintf(const char* format, ...); 19 # define TRACE(x...) _sPrintf("i810: " x) 20 #else 21 # define TRACE(x...) ; 22 #endif 23 24 25 // Global data used by various source files of the accelerant. 26 struct AccelerantInfo { 27 int deviceFileDesc; // file descriptor of kernel driver 28 29 SharedInfo* sharedInfo; // address of info shared between 30 // accelerants & driver 31 area_id sharedInfoArea; // shared info area ID 32 33 uint8* regs; // base address of MMIO register area 34 area_id regsArea; // MMIO register area ID 35 36 display_mode* modeList; // list of standard display modes 37 area_id modeListArea; // mode list area ID 38 39 bool bAccelerantIsClone; // true if this is a cloned accelerant 40 }; 41 42 extern AccelerantInfo gInfo; 43 44 45 // Prototypes of the interface functions called by the app_server. Note that 46 // the functions that are unique to a particular chip family, will be prefixed 47 // with the name of the family, and the functions that are applicable to all 48 // chips will have no prefix. 49 // ================================================================ 50 51 #if defined(__cplusplus) 52 extern "C" { 53 #endif 54 55 // General 56 status_t InitAccelerant(int fd); 57 ssize_t AccelerantCloneInfoSize(void); 58 void GetAccelerantCloneInfo(void* data); 59 status_t CloneAccelerant(void* data); 60 void UninitAccelerant(void); 61 status_t GetAccelerantDeviceInfo(accelerant_device_info* adi); 62 63 // Mode Configuration 64 uint32 AccelerantModeCount(void); 65 status_t GetModeList(display_mode* dm); 66 status_t ProposeDisplayMode(display_mode* target, const display_mode* low, 67 const display_mode* high); 68 status_t SetDisplayMode(display_mode* mode_to_set); 69 status_t GetDisplayMode(display_mode* current_mode); 70 status_t GetFrameBufferConfig(frame_buffer_config* a_frame_buffer); 71 status_t GetPixelClockLimits(display_mode* dm, uint32* low, uint32* high); 72 status_t MoveDisplay(uint16 h_display_start, uint16 v_display_start); 73 void I810_SetIndexedColors(uint count, uint8 first, uint8* color_data, 74 uint32 flags); 75 status_t GetEdidInfo(void* info, size_t size, uint32* _version); 76 77 // DPMS 78 uint32 I810_DPMSCapabilities(void); 79 uint32 I810_GetDPMSMode(void); 80 status_t I810_SetDPMSMode(uint32 dpms_flags); 81 82 // Engine Management 83 uint32 AccelerantEngineCount(void); 84 status_t AcquireEngine(uint32 capabilities, uint32 max_wait, sync_token* st, 85 engine_token** et); 86 status_t ReleaseEngine(engine_token* et, sync_token* st); 87 void WaitEngineIdle(void); 88 status_t GetSyncToken(engine_token* et, sync_token* st); 89 status_t SyncToToken(sync_token* st); 90 91 #if defined(__cplusplus) 92 } 93 #endif 94 95 96 // Prototypes for other functions that are called from source files other than 97 // where they are defined. 98 // ============================================================================ 99 status_t CreateModeList(bool (*checkMode)(const display_mode* mode)); 100 bool IsModeUsable(const display_mode* mode); 101 102 // Intel 810 functions. 103 104 status_t I810_Init(void); 105 bool I810_GetColorSpaceParams(int colorSpace, uint8& bpp, 106 uint32& maxPixelClk); 107 uint32 I810_GetWatermark(const DisplayModeEx& mode); 108 109 void I810_AdjustFrame(const DisplayModeEx& mode); 110 status_t I810_SetDisplayMode(const DisplayModeEx& mode); 111 112 113 #endif // _ACCELERANT_H 114