1/*
2	Copyright 2008, 2011 Haiku, Inc.  All rights reserved.
3	Distributed under the terms of the MIT license.
4
5	Authors:
6	Gerald Zajac
7*/
8
9#include "accelerant.h"
10
11
12extern "C" void*
13get_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:
20			return (void*)InitAccelerant;
21		case B_UNINIT_ACCELERANT:
22			return (void*)UninitAccelerant;
23		case B_CLONE_ACCELERANT:
24			return (void*)CloneAccelerant;
25		case B_ACCELERANT_CLONE_INFO_SIZE:
26			return (void*)AccelerantCloneInfoSize;
27		case B_GET_ACCELERANT_CLONE_INFO:
28			return (void*)GetAccelerantCloneInfo;
29		case B_GET_ACCELERANT_DEVICE_INFO:
30			return (void*)GetAccelerantDeviceInfo;
31		case B_ACCELERANT_RETRACE_SEMAPHORE:
32			return (void*)AccelerantRetraceSemaphore;
33
34		// Mode Configuration
35		case B_ACCELERANT_MODE_COUNT:
36			return (void*)AccelerantModeCount;
37		case B_GET_MODE_LIST:
38			return (void*)GetModeList;
39		case B_PROPOSE_DISPLAY_MODE:
40			return (void*)ProposeDisplayMode;
41		case B_SET_DISPLAY_MODE:
42			return (void*)SetDisplayMode;
43		case B_GET_DISPLAY_MODE:
44			return (void*)GetDisplayMode;
45		case B_GET_PREFERRED_DISPLAY_MODE:
46			return (void*)GetPreferredDisplayMode;
47		case B_GET_EDID_INFO:
48			return (void*)GetEdidInfo;
49		case B_GET_FRAME_BUFFER_CONFIG:
50			return (void*)GetFrameBufferConfig;
51		case B_GET_PIXEL_CLOCK_LIMITS:
52			return (void*)GetPixelClockLimits;
53		case B_MOVE_DISPLAY:
54			return (void*)MoveDisplay;
55		case B_SET_INDEXED_COLORS:
56			return (void*)(gInfo.SetIndexedColors);
57		case B_GET_TIMING_CONSTRAINTS:
58			return (void*)GetTimingConstraints;
59
60		// DPMS
61		case B_DPMS_CAPABILITIES:
62			return (void*)(gInfo.DPMSCapabilities);
63		case B_DPMS_MODE:
64			return (void*)(gInfo.GetDPMSMode);
65		case B_SET_DPMS_MODE:
66			return (void*)(gInfo.SetDPMSMode);
67
68		// Cursor
69		case B_SET_CURSOR_SHAPE:
70			return (void*)SetCursorShape;
71		case B_MOVE_CURSOR:
72			return (void*)MoveCursor;
73		case B_SHOW_CURSOR:
74			return (void*)(gInfo.ShowCursor);
75
76		// Engine Management
77		case B_ACCELERANT_ENGINE_COUNT:
78			return (void*)AccelerantEngineCount;
79		case B_ACQUIRE_ENGINE:
80			return (void*)AcquireEngine;
81		case B_RELEASE_ENGINE:
82			return (void*)ReleaseEngine;
83		case B_WAIT_ENGINE_IDLE:
84			return (void*)WaitEngineIdle;
85		case B_GET_SYNC_TOKEN:
86			return (void*)GetSyncToken;
87		case B_SYNC_TO_TOKEN:
88			return (void*)SyncToToken;
89
90		// 2D acceleration
91		case B_SCREEN_TO_SCREEN_BLIT:
92			return (void*)(gInfo.ScreenToScreenBlit);
93		case B_FILL_RECTANGLE:
94			return (void*)(gInfo.FillRectangle);
95		case B_INVERT_RECTANGLE:
96			return (void*)(gInfo.InvertRectangle);
97		case B_FILL_SPAN:
98			return (void*)(gInfo.FillSpan);
99
100		// Overlay
101		case B_OVERLAY_COUNT:
102			return (void*)OverlayCount;
103		case B_OVERLAY_SUPPORTED_SPACES:
104			return (void*)OverlaySupportedSpaces;
105		case B_OVERLAY_SUPPORTED_FEATURES:
106			return (void*)OverlaySupportedFeatures;
107		case B_ALLOCATE_OVERLAY_BUFFER:
108			return (void*)AllocateOverlayBuffer;
109		case B_RELEASE_OVERLAY_BUFFER:
110			return (void*)ReleaseOverlayBuffer;
111		case B_GET_OVERLAY_CONSTRAINTS:
112			return (void*)GetOverlayConstraints;
113		case B_ALLOCATE_OVERLAY:
114			return (void*)AllocateOverlay;
115		case B_RELEASE_OVERLAY:
116			return (void*)ReleaseOverlay;
117		case B_CONFIGURE_OVERLAY:
118			return (void*)ConfigureOverlay;
119	}
120
121	return NULL;	// Return null pointer for any feature not handled above
122}
123