xref: /haiku/src/add-ons/accelerants/virtio/hooks.cpp (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2005-2012, Axel Dörfler, axeld@pinc-software.de.
3  * Copyright 2016, Jessica Hamilton, jessica.l.hamilton@gmail.com
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 
7 
8 #include "accelerant_protos.h"
9 #include "accelerant.h"
10 
11 #include <new>
12 
13 
14 extern "C" void*
15 get_accelerant_hook(uint32 feature, void* data)
16 {
17 	switch (feature) {
18 		/* general */
19 		case B_INIT_ACCELERANT:
20 			return (void*)virtio_gpu_init_accelerant;
21 		case B_UNINIT_ACCELERANT:
22 			return (void*)virtio_gpu_uninit_accelerant;
23 		case B_CLONE_ACCELERANT:
24 			return (void*)virtio_gpu_clone_accelerant;
25 		case B_ACCELERANT_CLONE_INFO_SIZE:
26 			return (void*)virtio_gpu_accelerant_clone_info_size;
27 		case B_GET_ACCELERANT_CLONE_INFO:
28 			return (void*)virtio_gpu_get_accelerant_clone_info;
29 		case B_GET_ACCELERANT_DEVICE_INFO:
30 			return (void*)virtio_gpu_get_accelerant_device_info;
31 		case B_ACCELERANT_RETRACE_SEMAPHORE:
32 			return (void*)virtio_gpu_accelerant_retrace_semaphore;
33 
34 		/* mode configuration */
35 		case B_ACCELERANT_MODE_COUNT:
36 			return (void*)virtio_gpu_accelerant_mode_count;
37 		case B_GET_MODE_LIST:
38 			return (void*)virtio_gpu_get_mode_list;
39 		case B_GET_PREFERRED_DISPLAY_MODE:
40 			return (void*)virtio_gpu_get_preferred_mode;
41 		case B_SET_DISPLAY_MODE:
42 			return (void*)virtio_gpu_set_display_mode;
43 		case B_GET_DISPLAY_MODE:
44 			return (void*)virtio_gpu_get_display_mode;
45 		case B_GET_EDID_INFO:
46 			return (void*)virtio_gpu_get_edid_info;
47 		case B_GET_FRAME_BUFFER_CONFIG:
48 			return (void*)virtio_gpu_get_frame_buffer_config;
49 		case B_GET_PIXEL_CLOCK_LIMITS:
50 			return (void*)virtio_gpu_get_pixel_clock_limits;
51 	}
52 
53 	return NULL;
54 }
55 
56