xref: /haiku/src/add-ons/accelerants/et6x00/GetAccelerantHook.c (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 /*****************************************************************************\
2  * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
3  * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
4 \*****************************************************************************/
5 
6 #include "generic.h"
7 
8 
9 /*****************************************************************************/
10 /*
11  * The standard entry point.  Given a uint32 feature identifier, this routine
12  * returns a pointer to the function that implements the feature. Some features
13  * require more information than just the identifier to select the proper
14  * function. The extra information (which is specific to the feature) is
15  * pointed at by the void *data parameter. By default, no extra information
16  * is available. Any extra information available to choose the function will
17  * be noted on a case by case below.
18  */
19 void *get_accelerant_hook(uint32 feature, void *data) {
20 /* These definition is out of pure lazyness.*/
21 #define HOOK(x) case B_##x: return (void *)x
22 
23     switch (feature) {
24 
25 	/*
26 	 * One of either B_INIT_ACCELERANT or B_CLONE_ACCELERANT will be
27          * requested and subsequently called before any other hook is
28          * requested. All other feature hook selections can be predicated
29          * on variables assigned during the accelerant initialization process.
30 	 */
31 	/* initialization */
32 	HOOK(INIT_ACCELERANT);
33 	HOOK(CLONE_ACCELERANT);
34 
35 	HOOK(ACCELERANT_CLONE_INFO_SIZE);
36 	HOOK(GET_ACCELERANT_CLONE_INFO);
37 	HOOK(UNINIT_ACCELERANT);
38 	HOOK(GET_ACCELERANT_DEVICE_INFO);
39 
40 ///     HOOK(ACCELERANT_RETRACE_SEMAPHORE); /* Not implemented. Would be useful to have it implemented. */
41 
42 	/* mode configuration */
43 	HOOK(ACCELERANT_MODE_COUNT);
44 	HOOK(GET_MODE_LIST);
45 ///	HOOK(PROPOSE_DISPLAY_MODE);
46 	HOOK(SET_DISPLAY_MODE);
47 	HOOK(GET_DISPLAY_MODE);
48 	HOOK(GET_FRAME_BUFFER_CONFIG);
49 	HOOK(GET_PIXEL_CLOCK_LIMITS);
50 
51 	/* synchronization */
52 	HOOK(ACCELERANT_ENGINE_COUNT);
53 	HOOK(ACQUIRE_ENGINE);
54 	HOOK(RELEASE_ENGINE);
55 	HOOK(WAIT_ENGINE_IDLE);
56 	HOOK(GET_SYNC_TOKEN);
57 	HOOK(SYNC_TO_TOKEN);
58 
59 	/* 2D acceleration */
60 	HOOK(SCREEN_TO_SCREEN_BLIT);
61 	HOOK(FILL_RECTANGLE);
62     }
63 
64     /* Return a null pointer for any feature we don't understand. */
65     return 0;
66 
67 #undef HOOK
68 }
69 /*****************************************************************************/
70