xref: /haiku/src/add-ons/accelerants/radeon/GetAccelerantHook.c (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2 	Copyright (c) 2002, Thomas Kurschel
3 
4 
5 	Part of Radeon accelerant
6 
7 	Contains entry point to get public functions.
8 	(directly copied from sample driver)
9 */
10 
11 
12 #include "generic.h"
13 
14 /*
15 
16 The standard entry point.  Given a uint32 feature identifier, this routine
17 returns a pointer to the function that implements the feature.  Some features
18 require more information than just the identifier to select the proper
19 function.  The extra information (which is specific to the feature) is
20 pointed at by the void *data parameter.  By default, no extra information
21 is available.  Any extra information available to choose the function will be
22 noted on a case by case below.
23 
24 */
25 void *	get_accelerant_hook(uint32 feature, void *data) {
26 	(void)data;
27 
28 	switch (feature) {
29 /*
30 These definitions are out of pure lazyness.
31 */
32 #define HOOK(x) case B_##x: return (void *)x
33 #define ZERO(x) case B_##x: return (void *)0
34 
35 /*
36 One of either B_INIT_ACCELERANT or B_CLONE_ACCELERANT will be requested and
37 subsequently called before any other hook is requested.  All other feature
38 hook selections can be predicated on variables assigned during the accelerant
39 initialization process.
40 */
41 		/* initialization */
42 		HOOK(INIT_ACCELERANT);
43 		HOOK(CLONE_ACCELERANT);
44 
45 		HOOK(ACCELERANT_CLONE_INFO_SIZE);
46 		HOOK(GET_ACCELERANT_CLONE_INFO);
47 		HOOK(UNINIT_ACCELERANT);
48 		HOOK(GET_ACCELERANT_DEVICE_INFO);
49 		HOOK(ACCELERANT_RETRACE_SEMAPHORE);
50 
51 		/* mode configuration */
52 		HOOK(ACCELERANT_MODE_COUNT);
53 		HOOK(GET_MODE_LIST);
54 		HOOK(PROPOSE_DISPLAY_MODE);
55 		HOOK(SET_DISPLAY_MODE);
56 		HOOK(GET_DISPLAY_MODE);
57 		HOOK(GET_FRAME_BUFFER_CONFIG);
58 		HOOK(GET_PIXEL_CLOCK_LIMITS);
59 		HOOK(MOVE_DISPLAY);
60 		HOOK(SET_INDEXED_COLORS);
61 		//HOOK(GET_TIMING_CONSTRAINTS);
62 
63 		HOOK(DPMS_CAPABILITIES);
64 		HOOK(DPMS_MODE);
65 		HOOK(SET_DPMS_MODE);
66 
67 		/* cursor managment */
68 		HOOK(SET_CURSOR_SHAPE);
69 		HOOK(MOVE_CURSOR);
70 		HOOK(SHOW_CURSOR);
71 
72 		/* synchronization */
73 		HOOK(ACCELERANT_ENGINE_COUNT);
74 		HOOK(ACQUIRE_ENGINE);
75 		HOOK(RELEASE_ENGINE);
76 		HOOK(WAIT_ENGINE_IDLE);
77 		HOOK(GET_SYNC_TOKEN);
78 		HOOK(SYNC_TO_TOKEN);
79 
80 /*
81 When requesting an acceleration hook, the calling application provides a
82 pointer to the display_mode for which the acceleration function will be used.
83 Depending on the engine architecture, you may choose to provide a different
84 function to be used with each bit-depth.  In the sample driver we return
85 the same function all the time.
86 */
87 		/* 2D acceleration */
88 		HOOK(SCREEN_TO_SCREEN_BLIT);
89 		HOOK(FILL_RECTANGLE);
90 		HOOK(INVERT_RECTANGLE);
91 		HOOK(FILL_SPAN);
92 
93 		// overlay
94 		HOOK(OVERLAY_COUNT);
95 		HOOK(OVERLAY_SUPPORTED_SPACES);
96 		HOOK(OVERLAY_SUPPORTED_FEATURES);
97 		HOOK(ALLOCATE_OVERLAY_BUFFER);
98 		HOOK(RELEASE_OVERLAY_BUFFER);
99 		HOOK(GET_OVERLAY_CONSTRAINTS);
100 		HOOK(ALLOCATE_OVERLAY);
101 		HOOK(RELEASE_OVERLAY);
102 		HOOK(CONFIGURE_OVERLAY);
103 #undef HOOK
104 #undef ZERO
105 	}
106 /*
107 Return a null pointer for any feature we don't understand.
108 */
109 	return 0;
110 }
111