xref: /haiku/src/add-ons/accelerants/intel_extreme/hooks.cpp (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
1e404297eSAxel Dörfler /*
28f935c23SAxel Dörfler  * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3e404297eSAxel Dörfler  * Distributed under the terms of the MIT License.
4e404297eSAxel Dörfler  *
5e404297eSAxel Dörfler  * Authors:
6e404297eSAxel Dörfler  *		Axel Dörfler, axeld@pinc-software.de
7e404297eSAxel Dörfler  */
8e404297eSAxel Dörfler 
9e404297eSAxel Dörfler 
10e404297eSAxel Dörfler #include "accelerant_protos.h"
117d5957dfSAxel Dörfler #include "accelerant.h"
12e404297eSAxel Dörfler 
13e404297eSAxel Dörfler 
14e404297eSAxel Dörfler extern "C" void*
get_accelerant_hook(uint32 feature,void * data)15e404297eSAxel Dörfler get_accelerant_hook(uint32 feature, void* data)
16e404297eSAxel Dörfler {
17e404297eSAxel Dörfler 	switch (feature) {
18e404297eSAxel Dörfler 		/* general */
19e404297eSAxel Dörfler 		case B_INIT_ACCELERANT:
206c05095cSIthamar R. Adema 			return (void*)intel_init_accelerant;
21e404297eSAxel Dörfler 		case B_UNINIT_ACCELERANT:
226c05095cSIthamar R. Adema 			return (void*)intel_uninit_accelerant;
23e404297eSAxel Dörfler 		case B_CLONE_ACCELERANT:
246c05095cSIthamar R. Adema 			return (void*)intel_clone_accelerant;
25e404297eSAxel Dörfler 		case B_ACCELERANT_CLONE_INFO_SIZE:
266c05095cSIthamar R. Adema 			return (void*)intel_accelerant_clone_info_size;
27e404297eSAxel Dörfler 		case B_GET_ACCELERANT_CLONE_INFO:
286c05095cSIthamar R. Adema 			return (void*)intel_get_accelerant_clone_info;
29e404297eSAxel Dörfler 		case B_GET_ACCELERANT_DEVICE_INFO:
306c05095cSIthamar R. Adema 			return (void*)intel_get_accelerant_device_info;
31e404297eSAxel Dörfler 		case B_ACCELERANT_RETRACE_SEMAPHORE:
326c05095cSIthamar R. Adema 			return (void*)intel_accelerant_retrace_semaphore;
33e404297eSAxel Dörfler 
34e404297eSAxel Dörfler 		/* mode configuration */
35e404297eSAxel Dörfler 		case B_ACCELERANT_MODE_COUNT:
366c05095cSIthamar R. Adema 			return (void*)intel_accelerant_mode_count;
37e404297eSAxel Dörfler 		case B_GET_MODE_LIST:
386c05095cSIthamar R. Adema 			return (void*)intel_get_mode_list;
39e404297eSAxel Dörfler 		case B_PROPOSE_DISPLAY_MODE:
406c05095cSIthamar R. Adema 			return (void*)intel_propose_display_mode;
41befbf015SJérôme Duval 		case B_GET_PREFERRED_DISPLAY_MODE:
42befbf015SJérôme Duval 			return (void*)intel_get_preferred_mode;
43e404297eSAxel Dörfler 		case B_SET_DISPLAY_MODE:
446c05095cSIthamar R. Adema 			return (void*)intel_set_display_mode;
45e404297eSAxel Dörfler 		case B_GET_DISPLAY_MODE:
466c05095cSIthamar R. Adema 			return (void*)intel_get_display_mode;
4753d781f4SAxel Dörfler #ifdef __HAIKU__
4853d781f4SAxel Dörfler 		case B_GET_EDID_INFO:
4953d781f4SAxel Dörfler 			return (void*)intel_get_edid_info;
50*3316cfc9SRudolf Cornelissen 
51*3316cfc9SRudolf Cornelissen 		/* laptop panel backlight */
523a2b67b5SAdrien Destugues 		case B_SET_BRIGHTNESS:
53*3316cfc9SRudolf Cornelissen 			if (gInfo->shared_info->device_type.IsMobile())
543a2b67b5SAdrien Destugues 				return (void*)intel_set_brightness;
553a2b67b5SAdrien Destugues 		case B_GET_BRIGHTNESS:
56*3316cfc9SRudolf Cornelissen 			if (gInfo->shared_info->device_type.IsMobile())
573a2b67b5SAdrien Destugues 				return (void*)intel_get_brightness;
58*3316cfc9SRudolf Cornelissen 
59*3316cfc9SRudolf Cornelissen 			return NULL;
6053d781f4SAxel Dörfler #endif
61e404297eSAxel Dörfler 		case B_GET_FRAME_BUFFER_CONFIG:
626c05095cSIthamar R. Adema 			return (void*)intel_get_frame_buffer_config;
63e404297eSAxel Dörfler 		case B_GET_PIXEL_CLOCK_LIMITS:
646c05095cSIthamar R. Adema 			return (void*)intel_get_pixel_clock_limits;
65e404297eSAxel Dörfler 		case B_MOVE_DISPLAY:
666c05095cSIthamar R. Adema 			return (void*)intel_move_display;
67e404297eSAxel Dörfler 		case B_SET_INDEXED_COLORS:
686c05095cSIthamar R. Adema 			return (void*)intel_set_indexed_colors;
69e404297eSAxel Dörfler 		case B_GET_TIMING_CONSTRAINTS:
706c05095cSIthamar R. Adema 			return (void*)intel_get_timing_constraints;
71e404297eSAxel Dörfler 
72e404297eSAxel Dörfler 		/* DPMS */
73e404297eSAxel Dörfler 		case B_DPMS_CAPABILITIES:
746c05095cSIthamar R. Adema 			return (void*)intel_dpms_capabilities;
75e404297eSAxel Dörfler 		case B_DPMS_MODE:
766c05095cSIthamar R. Adema 			return (void*)intel_dpms_mode;
77e404297eSAxel Dörfler 		case B_SET_DPMS_MODE:
786c05095cSIthamar R. Adema 			return (void*)intel_set_dpms_mode;
79e404297eSAxel Dörfler 
80e404297eSAxel Dörfler 		/* cursor managment */
817d5957dfSAxel Dörfler 		case B_SET_CURSOR_SHAPE:
821c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
836c05095cSIthamar R. Adema 				return (void*)intel_set_cursor_shape;
84e404297eSAxel Dörfler 		case B_MOVE_CURSOR:
851c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
866c05095cSIthamar R. Adema 				return (void*)intel_move_cursor;
87e404297eSAxel Dörfler 		case B_SHOW_CURSOR:
881c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
896c05095cSIthamar R. Adema 				return (void*)intel_show_cursor;
907d5957dfSAxel Dörfler 
917d5957dfSAxel Dörfler 			return NULL;
927d5957dfSAxel Dörfler 
93e404297eSAxel Dörfler 		/* engine/synchronization */
94e404297eSAxel Dörfler 		case B_ACCELERANT_ENGINE_COUNT:
956c05095cSIthamar R. Adema 			return (void*)intel_accelerant_engine_count;
96e404297eSAxel Dörfler 		case B_ACQUIRE_ENGINE:
976c05095cSIthamar R. Adema 			return (void*)intel_acquire_engine;
98e404297eSAxel Dörfler 		case B_RELEASE_ENGINE:
996c05095cSIthamar R. Adema 			return (void*)intel_release_engine;
100e404297eSAxel Dörfler 		case B_WAIT_ENGINE_IDLE:
1016c05095cSIthamar R. Adema 			return (void*)intel_wait_engine_idle;
102e404297eSAxel Dörfler 		case B_GET_SYNC_TOKEN:
1036c05095cSIthamar R. Adema 			return (void*)intel_get_sync_token;
104e404297eSAxel Dörfler 		case B_SYNC_TO_TOKEN:
1056c05095cSIthamar R. Adema 			return (void*)intel_sync_to_token;
106e404297eSAxel Dörfler 
107e404297eSAxel Dörfler 		/* 2D acceleration */
1082ace35edSAxel Dörfler 		case B_SCREEN_TO_SCREEN_BLIT:
1096c05095cSIthamar R. Adema 			return (void*)intel_screen_to_screen_blit;
1102ace35edSAxel Dörfler 		case B_FILL_RECTANGLE:
1116c05095cSIthamar R. Adema 			return (void*)intel_fill_rectangle;
1122ace35edSAxel Dörfler 		case B_INVERT_RECTANGLE:
1136c05095cSIthamar R. Adema 			return (void*)intel_invert_rectangle;
1142ace35edSAxel Dörfler 		case B_FILL_SPAN:
115ca1a22a7SStephan Aßmus 			return NULL;//(void*)intel_fill_span;
116d906e6a0SAxel Dörfler 
117e404297eSAxel Dörfler 		// overlay
118eea30ef3SAxel Dörfler 		case B_OVERLAY_COUNT:
1190db852e1SAxel Dörfler 			return (void*)intel_overlay_count;
120eea30ef3SAxel Dörfler 		case B_OVERLAY_SUPPORTED_SPACES:
1216c05095cSIthamar R. Adema 			return (void*)intel_overlay_supported_spaces;
122eea30ef3SAxel Dörfler 		case B_OVERLAY_SUPPORTED_FEATURES:
1236c05095cSIthamar R. Adema 			return (void*)intel_overlay_supported_features;
124eea30ef3SAxel Dörfler 		case B_ALLOCATE_OVERLAY_BUFFER:
1258f935c23SAxel Dörfler 			// TODO: overlay doesn't seem to work on these chips
12684b7116dSAlexander von Gluck IV 			if (gInfo->shared_info->device_type.InGroup(INTEL_GROUP_91x)
12784b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_94x)
12884b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.IsModel(INTEL_MODEL_965M)
12984b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_G4x)
1303cfe2997SAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_PIN)
13184b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_ILK)
13284b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SER5)
13384b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SOC0))
1348f935c23SAxel Dörfler 				return NULL;
1358f935c23SAxel Dörfler 
1366c05095cSIthamar R. Adema 			return (void*)intel_allocate_overlay_buffer;
137eea30ef3SAxel Dörfler 		case B_RELEASE_OVERLAY_BUFFER:
1386c05095cSIthamar R. Adema 			return (void*)intel_release_overlay_buffer;
139eea30ef3SAxel Dörfler 		case B_GET_OVERLAY_CONSTRAINTS:
1406c05095cSIthamar R. Adema 			return (void*)intel_get_overlay_constraints;
141eea30ef3SAxel Dörfler 		case B_ALLOCATE_OVERLAY:
1426c05095cSIthamar R. Adema 			return (void*)intel_allocate_overlay;
143eea30ef3SAxel Dörfler 		case B_RELEASE_OVERLAY:
1446c05095cSIthamar R. Adema 			return (void*)intel_release_overlay;
145eea30ef3SAxel Dörfler 		case B_CONFIGURE_OVERLAY:
1466c05095cSIthamar R. Adema 			return (void*)intel_configure_overlay;
147e404297eSAxel Dörfler 	}
148e404297eSAxel Dörfler 
149e404297eSAxel Dörfler 	return NULL;
150e404297eSAxel Dörfler }
151e404297eSAxel Dörfler 
152