vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / intel_extreme / hooks.cpp
blob7ea4dac0970dcc61af988345cf85c6ec32f9dd77
1 /*
2 * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
10 #include "accelerant_protos.h"
11 #include "accelerant.h"
14 extern "C" void*
15 get_accelerant_hook(uint32 feature, void* data)
17 switch (feature) {
18 /* general */
19 case B_INIT_ACCELERANT:
20 return (void*)intel_init_accelerant;
21 case B_UNINIT_ACCELERANT:
22 return (void*)intel_uninit_accelerant;
23 case B_CLONE_ACCELERANT:
24 return (void*)intel_clone_accelerant;
25 case B_ACCELERANT_CLONE_INFO_SIZE:
26 return (void*)intel_accelerant_clone_info_size;
27 case B_GET_ACCELERANT_CLONE_INFO:
28 return (void*)intel_get_accelerant_clone_info;
29 case B_GET_ACCELERANT_DEVICE_INFO:
30 return (void*)intel_get_accelerant_device_info;
31 case B_ACCELERANT_RETRACE_SEMAPHORE:
32 return (void*)intel_accelerant_retrace_semaphore;
34 /* mode configuration */
35 case B_ACCELERANT_MODE_COUNT:
36 return (void*)intel_accelerant_mode_count;
37 case B_GET_MODE_LIST:
38 return (void*)intel_get_mode_list;
39 case B_PROPOSE_DISPLAY_MODE:
40 return (void*)intel_propose_display_mode;
41 case B_SET_DISPLAY_MODE:
42 return (void*)intel_set_display_mode;
43 case B_GET_DISPLAY_MODE:
44 return (void*)intel_get_display_mode;
45 #ifdef __HAIKU__
46 case B_GET_EDID_INFO:
47 return (void*)intel_get_edid_info;
48 case B_SET_BRIGHTNESS:
49 return (void*)intel_set_brightness;
50 case B_GET_BRIGHTNESS:
51 return (void*)intel_get_brightness;
52 #endif
53 case B_GET_FRAME_BUFFER_CONFIG:
54 return (void*)intel_get_frame_buffer_config;
55 case B_GET_PIXEL_CLOCK_LIMITS:
56 return (void*)intel_get_pixel_clock_limits;
57 case B_MOVE_DISPLAY:
58 return (void*)intel_move_display;
59 case B_SET_INDEXED_COLORS:
60 return (void*)intel_set_indexed_colors;
61 case B_GET_TIMING_CONSTRAINTS:
62 return (void*)intel_get_timing_constraints;
64 /* DPMS */
65 case B_DPMS_CAPABILITIES:
66 return (void*)intel_dpms_capabilities;
67 case B_DPMS_MODE:
68 return (void*)intel_dpms_mode;
69 case B_SET_DPMS_MODE:
70 return (void*)intel_set_dpms_mode;
72 /* cursor managment */
73 case B_SET_CURSOR_SHAPE:
74 if (gInfo->shared_info->cursor_memory != NULL)
75 return (void*)intel_set_cursor_shape;
76 case B_MOVE_CURSOR:
77 if (gInfo->shared_info->cursor_memory != NULL)
78 return (void*)intel_move_cursor;
79 case B_SHOW_CURSOR:
80 if (gInfo->shared_info->cursor_memory != NULL)
81 return (void*)intel_show_cursor;
83 return NULL;
85 /* engine/synchronization */
86 case B_ACCELERANT_ENGINE_COUNT:
87 return (void*)intel_accelerant_engine_count;
88 case B_ACQUIRE_ENGINE:
89 return (void*)intel_acquire_engine;
90 case B_RELEASE_ENGINE:
91 return (void*)intel_release_engine;
92 case B_WAIT_ENGINE_IDLE:
93 return (void*)intel_wait_engine_idle;
94 case B_GET_SYNC_TOKEN:
95 return (void*)intel_get_sync_token;
96 case B_SYNC_TO_TOKEN:
97 return (void*)intel_sync_to_token;
99 /* 2D acceleration */
100 case B_SCREEN_TO_SCREEN_BLIT:
101 return (void*)intel_screen_to_screen_blit;
102 case B_FILL_RECTANGLE:
103 return (void*)intel_fill_rectangle;
104 case B_INVERT_RECTANGLE:
105 return (void*)intel_invert_rectangle;
106 case B_FILL_SPAN:
107 return NULL;//(void*)intel_fill_span;
109 // overlay
110 case B_OVERLAY_COUNT:
111 return (void*)intel_overlay_count;
112 case B_OVERLAY_SUPPORTED_SPACES:
113 return (void*)intel_overlay_supported_spaces;
114 case B_OVERLAY_SUPPORTED_FEATURES:
115 return (void*)intel_overlay_supported_features;
116 case B_ALLOCATE_OVERLAY_BUFFER:
117 // TODO: overlay doesn't seem to work on these chips
118 if (gInfo->shared_info->device_type.InGroup(INTEL_GROUP_91x)
119 || gInfo->shared_info->device_type.InGroup(INTEL_GROUP_94x)
120 || gInfo->shared_info->device_type.IsModel(INTEL_MODEL_965M)
121 || gInfo->shared_info->device_type.InGroup(INTEL_GROUP_G4x)
122 || gInfo->shared_info->device_type.InGroup(INTEL_GROUP_PIN)
123 || gInfo->shared_info->device_type.InGroup(INTEL_GROUP_ILK)
124 || gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SER5)
125 || gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_POVR)
126 || gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SOC0))
127 return NULL;
129 return (void*)intel_allocate_overlay_buffer;
130 case B_RELEASE_OVERLAY_BUFFER:
131 return (void*)intel_release_overlay_buffer;
132 case B_GET_OVERLAY_CONSTRAINTS:
133 return (void*)intel_get_overlay_constraints;
134 case B_ALLOCATE_OVERLAY:
135 return (void*)intel_allocate_overlay;
136 case B_RELEASE_OVERLAY:
137 return (void*)intel_release_overlay;
138 case B_CONFIGURE_OVERLAY:
139 return (void*)intel_configure_overlay;
142 return NULL;