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 18extern "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. 26struct 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 42extern 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) 52extern "C" { 53#endif 54 55// General 56status_t InitAccelerant(int fd); 57ssize_t AccelerantCloneInfoSize(void); 58void GetAccelerantCloneInfo(void* data); 59status_t CloneAccelerant(void* data); 60void UninitAccelerant(void); 61status_t GetAccelerantDeviceInfo(accelerant_device_info* adi); 62 63// Mode Configuration 64uint32 AccelerantModeCount(void); 65status_t GetModeList(display_mode* dm); 66status_t ProposeDisplayMode(display_mode* target, const display_mode* low, 67 const display_mode* high); 68status_t SetDisplayMode(display_mode* mode_to_set); 69status_t GetDisplayMode(display_mode* current_mode); 70status_t GetFrameBufferConfig(frame_buffer_config* a_frame_buffer); 71status_t GetPixelClockLimits(display_mode* dm, uint32* low, uint32* high); 72status_t MoveDisplay(uint16 h_display_start, uint16 v_display_start); 73void I810_SetIndexedColors(uint count, uint8 first, uint8* color_data, 74 uint32 flags); 75status_t GetEdidInfo(void* info, size_t size, uint32* _version); 76 77// DPMS 78uint32 I810_DPMSCapabilities(void); 79uint32 I810_GetDPMSMode(void); 80status_t I810_SetDPMSMode(uint32 dpms_flags); 81 82// Engine Management 83uint32 AccelerantEngineCount(void); 84status_t AcquireEngine(uint32 capabilities, uint32 max_wait, sync_token* st, 85 engine_token** et); 86status_t ReleaseEngine(engine_token* et, sync_token* st); 87void WaitEngineIdle(void); 88status_t GetSyncToken(engine_token* et, sync_token* st); 89status_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// ============================================================================ 99status_t CreateModeList(bool (*checkMode)(const display_mode* mode)); 100bool IsModeUsable(const display_mode* mode); 101 102// Intel 810 functions. 103 104status_t I810_Init(void); 105bool I810_GetColorSpaceParams(int colorSpace, uint8& bpp, 106 uint32& maxPixelClk); 107uint32 I810_GetWatermark(const DisplayModeEx& mode); 108 109void I810_AdjustFrame(const DisplayModeEx& mode); 110status_t I810_SetDisplayMode(const DisplayModeEx& mode); 111 112 113#endif // _ACCELERANT_H 114