xref: /haiku/src/add-ons/accelerants/ati/hooks.cpp (revision 2222d0559df303a9846a2fad53741f8b20b14d7c)
1 /*
2 	Copyright 2008 Haiku, Inc.  All rights reserved.
3 	Distributed under the terms of the MIT license.
4 
5 	Authors:
6 	Gerald Zajac 2008
7 */
8 
9 #include "accelerant.h"
10 
11 
12 extern "C" void*
13 get_accelerant_hook(uint32 feature, void* data)
14 {
15 	(void)data;		// avoid compiler warning for unused arg
16 
17 	switch (feature) {
18 		// General
19 		case B_INIT_ACCELERANT:				return (void*)InitAccelerant;
20 		case B_UNINIT_ACCELERANT:			return (void*)UninitAccelerant;
21 		case B_CLONE_ACCELERANT:			return (void*)CloneAccelerant;
22 		case B_ACCELERANT_CLONE_INFO_SIZE:	return (void*)AccelerantCloneInfoSize;
23 		case B_GET_ACCELERANT_CLONE_INFO:	return (void*)GetAccelerantCloneInfo;
24 		case B_GET_ACCELERANT_DEVICE_INFO:	return (void*)GetAccelerantDeviceInfo;
25 		case B_ACCELERANT_RETRACE_SEMAPHORE: return (void*)AccelerantRetraceSemaphore;
26 
27 		// Mode Configuration
28 		case B_ACCELERANT_MODE_COUNT:	return (void*)AccelerantModeCount;
29 		case B_GET_MODE_LIST:			return (void*)GetModeList;
30 		case B_PROPOSE_DISPLAY_MODE:	return (void*)ProposeDisplayMode;
31 		case B_SET_DISPLAY_MODE:		return (void*)SetDisplayMode;
32 		case B_GET_DISPLAY_MODE:		return (void*)GetDisplayMode;
33 		case B_GET_PREFERRED_DISPLAY_MODE: return (void*)GetPreferredDisplayMode;
34 		case B_GET_EDID_INFO:			return (void*)GetEdidInfo;
35 		case B_GET_FRAME_BUFFER_CONFIG:	return (void*)GetFrameBufferConfig;
36 		case B_GET_PIXEL_CLOCK_LIMITS:	return (void*)GetPixelClockLimits;
37 		case B_MOVE_DISPLAY:			return (void*)MoveDisplay;
38 		case B_SET_INDEXED_COLORS:		return (void*)(gInfo.SetIndexedColors);
39 		case B_GET_TIMING_CONSTRAINTS:	return (void*)GetTimingConstraints;
40 
41 		// DPMS
42 		case B_DPMS_CAPABILITIES:		return (void*)(gInfo.DPMSCapabilities);
43 		case B_DPMS_MODE:				return (void*)(gInfo.GetDPMSMode);
44 		case B_SET_DPMS_MODE:			return (void*)(gInfo.SetDPMSMode);
45 
46 		// Cursor
47 		case B_SET_CURSOR_SHAPE:		return (void*)SetCursorShape;
48 		case B_MOVE_CURSOR:				return (void*)MoveCursor;
49 		case B_SHOW_CURSOR:				return (void*)(gInfo.ShowCursor);
50 
51 		// Engine Management
52 		case B_ACCELERANT_ENGINE_COUNT:	return (void*)AccelerantEngineCount;
53 		case B_ACQUIRE_ENGINE:			return (void*)AcquireEngine;
54 		case B_RELEASE_ENGINE:			return (void*)ReleaseEngine;
55 		case B_WAIT_ENGINE_IDLE:		return (void*)WaitEngineIdle;
56 		case B_GET_SYNC_TOKEN:			return (void*)GetSyncToken;
57 		case B_SYNC_TO_TOKEN:			return (void*)SyncToToken;
58 
59 		// 2D acceleration
60 		case B_SCREEN_TO_SCREEN_BLIT:	return (void*)(gInfo.ScreenToScreenBlit);
61 		case B_FILL_RECTANGLE:			return (void*)(gInfo.FillRectangle);
62 		case B_INVERT_RECTANGLE:		return (void*)(gInfo.InvertRectangle);
63 		case B_FILL_SPAN:				return (void*)(gInfo.FillSpan);
64 	}
65 
66 	return NULL;	// Return null pointer for any feature not handled above
67 }
68