xref: /haiku/src/add-ons/accelerants/radeon/GetAccelerantHook.c (revision 2a37e4c1cf59b445e309a3880ceed82d25a0d107)
1409f1731Sshadow303 /*
2409f1731Sshadow303 	Copyright (c) 2002, Thomas Kurschel
3409f1731Sshadow303 
4409f1731Sshadow303 
5409f1731Sshadow303 	Part of Radeon accelerant
6409f1731Sshadow303 
7409f1731Sshadow303 	Contains entry point to get public functions.
8409f1731Sshadow303 	(directly copied from sample driver)
9409f1731Sshadow303 */
10409f1731Sshadow303 
11409f1731Sshadow303 
12409f1731Sshadow303 #include "generic.h"
13409f1731Sshadow303 
14409f1731Sshadow303 /*
15409f1731Sshadow303 
16409f1731Sshadow303 The standard entry point.  Given a uint32 feature identifier, this routine
17409f1731Sshadow303 returns a pointer to the function that implements the feature.  Some features
18409f1731Sshadow303 require more information than just the identifier to select the proper
19409f1731Sshadow303 function.  The extra information (which is specific to the feature) is
20409f1731Sshadow303 pointed at by the void *data parameter.  By default, no extra information
21409f1731Sshadow303 is available.  Any extra information available to choose the function will be
22409f1731Sshadow303 noted on a case by case below.
23409f1731Sshadow303 
24409f1731Sshadow303 */
25409f1731Sshadow303 void *	get_accelerant_hook(uint32 feature, void *data) {
26*2a37e4c1Sshadow303 	(void)data;
27*2a37e4c1Sshadow303 
28409f1731Sshadow303 	switch (feature) {
29409f1731Sshadow303 /*
30409f1731Sshadow303 These definitions are out of pure lazyness.
31409f1731Sshadow303 */
32409f1731Sshadow303 #define HOOK(x) case B_##x: return (void *)x
33409f1731Sshadow303 #define ZERO(x) case B_##x: return (void *)0
34409f1731Sshadow303 
35409f1731Sshadow303 /*
36409f1731Sshadow303 One of either B_INIT_ACCELERANT or B_CLONE_ACCELERANT will be requested and
37409f1731Sshadow303 subsequently called before any other hook is requested.  All other feature
38409f1731Sshadow303 hook selections can be predicated on variables assigned during the accelerant
39409f1731Sshadow303 initialization process.
40409f1731Sshadow303 */
41409f1731Sshadow303 		/* initialization */
42409f1731Sshadow303 		HOOK(INIT_ACCELERANT);
43409f1731Sshadow303 		HOOK(CLONE_ACCELERANT);
44409f1731Sshadow303 
45409f1731Sshadow303 		HOOK(ACCELERANT_CLONE_INFO_SIZE);
46409f1731Sshadow303 		HOOK(GET_ACCELERANT_CLONE_INFO);
47409f1731Sshadow303 		HOOK(UNINIT_ACCELERANT);
48409f1731Sshadow303 		HOOK(GET_ACCELERANT_DEVICE_INFO);
49409f1731Sshadow303 		HOOK(ACCELERANT_RETRACE_SEMAPHORE);
50409f1731Sshadow303 
51409f1731Sshadow303 		/* mode configuration */
52409f1731Sshadow303 		HOOK(ACCELERANT_MODE_COUNT);
53409f1731Sshadow303 		HOOK(GET_MODE_LIST);
54409f1731Sshadow303 		HOOK(PROPOSE_DISPLAY_MODE);
55409f1731Sshadow303 		HOOK(SET_DISPLAY_MODE);
56409f1731Sshadow303 		HOOK(GET_DISPLAY_MODE);
57409f1731Sshadow303 		HOOK(GET_FRAME_BUFFER_CONFIG);
58409f1731Sshadow303 		HOOK(GET_PIXEL_CLOCK_LIMITS);
59409f1731Sshadow303 		HOOK(MOVE_DISPLAY);
60409f1731Sshadow303 		HOOK(SET_INDEXED_COLORS);
61409f1731Sshadow303 		//HOOK(GET_TIMING_CONSTRAINTS);
62409f1731Sshadow303 
63409f1731Sshadow303 		HOOK(DPMS_CAPABILITIES);
64409f1731Sshadow303 		HOOK(DPMS_MODE);
65409f1731Sshadow303 		HOOK(SET_DPMS_MODE);
66409f1731Sshadow303 
67409f1731Sshadow303 		/* cursor managment */
68409f1731Sshadow303 		HOOK(SET_CURSOR_SHAPE);
69409f1731Sshadow303 		HOOK(MOVE_CURSOR);
70409f1731Sshadow303 		HOOK(SHOW_CURSOR);
71409f1731Sshadow303 
72409f1731Sshadow303 		/* synchronization */
73409f1731Sshadow303 		HOOK(ACCELERANT_ENGINE_COUNT);
74409f1731Sshadow303 		HOOK(ACQUIRE_ENGINE);
75409f1731Sshadow303 		HOOK(RELEASE_ENGINE);
76409f1731Sshadow303 		HOOK(WAIT_ENGINE_IDLE);
77409f1731Sshadow303 		HOOK(GET_SYNC_TOKEN);
78409f1731Sshadow303 		HOOK(SYNC_TO_TOKEN);
79409f1731Sshadow303 
80409f1731Sshadow303 /*
81409f1731Sshadow303 When requesting an acceleration hook, the calling application provides a
82409f1731Sshadow303 pointer to the display_mode for which the acceleration function will be used.
83409f1731Sshadow303 Depending on the engine architecture, you may choose to provide a different
84409f1731Sshadow303 function to be used with each bit-depth.  In the sample driver we return
85409f1731Sshadow303 the same function all the time.
86409f1731Sshadow303 */
87409f1731Sshadow303 		/* 2D acceleration */
88409f1731Sshadow303 		HOOK(SCREEN_TO_SCREEN_BLIT);
89409f1731Sshadow303 		HOOK(FILL_RECTANGLE);
90409f1731Sshadow303 		HOOK(INVERT_RECTANGLE);
91409f1731Sshadow303 		HOOK(FILL_SPAN);
92409f1731Sshadow303 
93409f1731Sshadow303 		// overlay
94409f1731Sshadow303 		HOOK(OVERLAY_COUNT);
95409f1731Sshadow303 		HOOK(OVERLAY_SUPPORTED_SPACES);
96409f1731Sshadow303 		HOOK(OVERLAY_SUPPORTED_FEATURES);
97409f1731Sshadow303 		HOOK(ALLOCATE_OVERLAY_BUFFER);
98409f1731Sshadow303 		HOOK(RELEASE_OVERLAY_BUFFER);
99409f1731Sshadow303 		HOOK(GET_OVERLAY_CONSTRAINTS);
100409f1731Sshadow303 		HOOK(ALLOCATE_OVERLAY);
101409f1731Sshadow303 		HOOK(RELEASE_OVERLAY);
102409f1731Sshadow303 		HOOK(CONFIGURE_OVERLAY);
103409f1731Sshadow303 #undef HOOK
104409f1731Sshadow303 #undef ZERO
105409f1731Sshadow303 	}
106409f1731Sshadow303 /*
107409f1731Sshadow303 Return a null pointer for any feature we don't understand.
108409f1731Sshadow303 */
109409f1731Sshadow303 	return 0;
110409f1731Sshadow303 }
111