xref: /haiku/src/add-ons/accelerants/intel_extreme/hooks.cpp (revision befbf015152d7ce4f95aa036d42337752ac86b67)
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*
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;
41*befbf015SJérôme Duval 		case B_GET_PREFERRED_DISPLAY_MODE:
42*befbf015SJé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;
503a2b67b5SAdrien Destugues 		case B_SET_BRIGHTNESS:
513a2b67b5SAdrien Destugues 			return (void*)intel_set_brightness;
523a2b67b5SAdrien Destugues 		case B_GET_BRIGHTNESS:
533a2b67b5SAdrien Destugues 			return (void*)intel_get_brightness;
5453d781f4SAxel Dörfler #endif
55e404297eSAxel Dörfler 		case B_GET_FRAME_BUFFER_CONFIG:
566c05095cSIthamar R. Adema 			return (void*)intel_get_frame_buffer_config;
57e404297eSAxel Dörfler 		case B_GET_PIXEL_CLOCK_LIMITS:
586c05095cSIthamar R. Adema 			return (void*)intel_get_pixel_clock_limits;
59e404297eSAxel Dörfler 		case B_MOVE_DISPLAY:
606c05095cSIthamar R. Adema 			return (void*)intel_move_display;
61e404297eSAxel Dörfler 		case B_SET_INDEXED_COLORS:
626c05095cSIthamar R. Adema 			return (void*)intel_set_indexed_colors;
63e404297eSAxel Dörfler 		case B_GET_TIMING_CONSTRAINTS:
646c05095cSIthamar R. Adema 			return (void*)intel_get_timing_constraints;
65e404297eSAxel Dörfler 
66e404297eSAxel Dörfler 		/* DPMS */
67e404297eSAxel Dörfler 		case B_DPMS_CAPABILITIES:
686c05095cSIthamar R. Adema 			return (void*)intel_dpms_capabilities;
69e404297eSAxel Dörfler 		case B_DPMS_MODE:
706c05095cSIthamar R. Adema 			return (void*)intel_dpms_mode;
71e404297eSAxel Dörfler 		case B_SET_DPMS_MODE:
726c05095cSIthamar R. Adema 			return (void*)intel_set_dpms_mode;
73e404297eSAxel Dörfler 
74e404297eSAxel Dörfler 		/* cursor managment */
757d5957dfSAxel Dörfler 		case B_SET_CURSOR_SHAPE:
761c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
776c05095cSIthamar R. Adema 				return (void*)intel_set_cursor_shape;
78e404297eSAxel Dörfler 		case B_MOVE_CURSOR:
791c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
806c05095cSIthamar R. Adema 				return (void*)intel_move_cursor;
81e404297eSAxel Dörfler 		case B_SHOW_CURSOR:
821c34b9b1SAxel Dörfler 			if (gInfo->shared_info->cursor_memory != NULL)
836c05095cSIthamar R. Adema 				return (void*)intel_show_cursor;
847d5957dfSAxel Dörfler 
857d5957dfSAxel Dörfler 			return NULL;
867d5957dfSAxel Dörfler 
87e404297eSAxel Dörfler 		/* engine/synchronization */
88e404297eSAxel Dörfler 		case B_ACCELERANT_ENGINE_COUNT:
896c05095cSIthamar R. Adema 			return (void*)intel_accelerant_engine_count;
90e404297eSAxel Dörfler 		case B_ACQUIRE_ENGINE:
916c05095cSIthamar R. Adema 			return (void*)intel_acquire_engine;
92e404297eSAxel Dörfler 		case B_RELEASE_ENGINE:
936c05095cSIthamar R. Adema 			return (void*)intel_release_engine;
94e404297eSAxel Dörfler 		case B_WAIT_ENGINE_IDLE:
956c05095cSIthamar R. Adema 			return (void*)intel_wait_engine_idle;
96e404297eSAxel Dörfler 		case B_GET_SYNC_TOKEN:
976c05095cSIthamar R. Adema 			return (void*)intel_get_sync_token;
98e404297eSAxel Dörfler 		case B_SYNC_TO_TOKEN:
996c05095cSIthamar R. Adema 			return (void*)intel_sync_to_token;
100e404297eSAxel Dörfler 
101e404297eSAxel Dörfler 		/* 2D acceleration */
1022ace35edSAxel Dörfler 		case B_SCREEN_TO_SCREEN_BLIT:
1036c05095cSIthamar R. Adema 			return (void*)intel_screen_to_screen_blit;
1042ace35edSAxel Dörfler 		case B_FILL_RECTANGLE:
1056c05095cSIthamar R. Adema 			return (void*)intel_fill_rectangle;
1062ace35edSAxel Dörfler 		case B_INVERT_RECTANGLE:
1076c05095cSIthamar R. Adema 			return (void*)intel_invert_rectangle;
1082ace35edSAxel Dörfler 		case B_FILL_SPAN:
109ca1a22a7SStephan Aßmus 			return NULL;//(void*)intel_fill_span;
110d906e6a0SAxel Dörfler 
111e404297eSAxel Dörfler 		// overlay
112eea30ef3SAxel Dörfler 		case B_OVERLAY_COUNT:
1130db852e1SAxel Dörfler 			return (void*)intel_overlay_count;
114eea30ef3SAxel Dörfler 		case B_OVERLAY_SUPPORTED_SPACES:
1156c05095cSIthamar R. Adema 			return (void*)intel_overlay_supported_spaces;
116eea30ef3SAxel Dörfler 		case B_OVERLAY_SUPPORTED_FEATURES:
1176c05095cSIthamar R. Adema 			return (void*)intel_overlay_supported_features;
118eea30ef3SAxel Dörfler 		case B_ALLOCATE_OVERLAY_BUFFER:
1198f935c23SAxel Dörfler 			// TODO: overlay doesn't seem to work on these chips
12084b7116dSAlexander von Gluck IV 			if (gInfo->shared_info->device_type.InGroup(INTEL_GROUP_91x)
12184b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_94x)
12284b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.IsModel(INTEL_MODEL_965M)
12384b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_G4x)
1243cfe2997SAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_PIN)
12584b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InGroup(INTEL_GROUP_ILK)
12684b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SER5)
12784b7116dSAlexander von Gluck IV 				|| gInfo->shared_info->device_type.InFamily(INTEL_FAMILY_SOC0))
1288f935c23SAxel Dörfler 				return NULL;
1298f935c23SAxel Dörfler 
1306c05095cSIthamar R. Adema 			return (void*)intel_allocate_overlay_buffer;
131eea30ef3SAxel Dörfler 		case B_RELEASE_OVERLAY_BUFFER:
1326c05095cSIthamar R. Adema 			return (void*)intel_release_overlay_buffer;
133eea30ef3SAxel Dörfler 		case B_GET_OVERLAY_CONSTRAINTS:
1346c05095cSIthamar R. Adema 			return (void*)intel_get_overlay_constraints;
135eea30ef3SAxel Dörfler 		case B_ALLOCATE_OVERLAY:
1366c05095cSIthamar R. Adema 			return (void*)intel_allocate_overlay;
137eea30ef3SAxel Dörfler 		case B_RELEASE_OVERLAY:
1386c05095cSIthamar R. Adema 			return (void*)intel_release_overlay;
139eea30ef3SAxel Dörfler 		case B_CONFIGURE_OVERLAY:
1406c05095cSIthamar R. Adema 			return (void*)intel_configure_overlay;
141e404297eSAxel Dörfler 	}
142e404297eSAxel Dörfler 
143e404297eSAxel Dörfler 	return NULL;
144e404297eSAxel Dörfler }
145e404297eSAxel Dörfler 
146