vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / radeon / radeon_accelerant.h
blob184858dc7f2f1048b9aeb207f1286267a4ab3a10
1 /*
2 Copyright (c) 2002-2005, Thomas Kurschel
5 Part of Radeon accelerant
7 Internal header file
8 */
10 #ifndef _RADEON_ACCELERANT_H
11 #define _RADEON_ACCELERANT_H
14 #include "radeon_interface.h"
15 #include "accelerant_ext.h"
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
21 void _sPrintf(const char *format, ...);
22 //bool set_dprintf_enabled(bool); /* returns old enable flag */
24 #define dprintf _sPrintf
26 extern int debug_level_flow;
27 extern int debug_level_info;
28 extern int debug_level_error;
30 /*#define DEBUG_WAIT_ON_MSG 1000000
31 #define DEBUG_WAIT_ON_ERROR 1000000*/
33 #define DEBUG_MSG_PREFIX "Radeon - "
35 #define DEBUG_MAX_LEVEL_FLOW 3
37 #include "debug_ext.h"
40 // info about this accelerant
41 typedef struct accelerator_info {
42 shared_info *si; // info shared between accelerants
43 virtual_card *vc; // associated virtual card
44 vuint8 *regs; // pointer to mapped registers
45 // !! dont't make it vuint32, access macros rely on 8 bits !!
47 area_id shared_info_area; // info shared between accelerants
48 area_id regs_area; // MM I/O registers
49 area_id virtual_card_area; // info about virtual card
51 // mapped-in (non)-local memory;
52 // as si->local_mem contains a pointer to the local frame buffer,
53 // only mt_pci and mt_agp are filled directly, mt_nonlocal contains
54 // a copy of either mt_pci or mt_agp, mt_local a copy of si->local_mem
55 struct {
56 area_id area; // area of clone
57 unsigned char *data; // CPU address of area
58 } mapped_memory[mt_last+1];
60 int accelerant_is_clone; // true, if this is a cloned accelerant
62 int fd; // file descriptor of kernel driver
63 struct log_info_t *log;
65 area_id mode_list_area; // cloned list of standard display modes
66 display_mode *mode_list; // list of standard display modes
67 } accelerator_info;
70 #define IS_INTERNAL_TV_OUT( tv_chip ) \
71 ( (tv_chip) == tc_internal_rt1 || (tv_chip) == tc_internal_rt2 )
74 // vesa_modes.c
75 extern const display_timing vesa_mode_list[];
76 extern const size_t vesa_mode_list_count;
78 // SetDisplayMode.c
79 uint32 Radeon_RoundVWidth( int virtual_width, int bpp );
80 status_t Radeon_MoveDisplay( accelerator_info *ai, uint16 h_display_start, uint16 v_display_start );
81 void Radeon_EnableIRQ( accelerator_info *ai, bool enable );
83 // multimon.c
84 void Radeon_HideMultiMode( virtual_card *vc, display_mode *mode );
85 void Radeon_DetectMultiMode( virtual_card *vc, display_mode *mode );
86 void Radeon_VerifyMultiMode( virtual_card *vc, shared_info *si, display_mode *mode );
87 void Radeon_InitMultiModeVars( accelerator_info *ai, display_mode *mode );
88 status_t Radeon_CheckMultiMonTunnel( virtual_card *vc, display_mode *mode,
89 const display_mode *low, const display_mode *high, bool *isTunnel );
90 bool Radeon_NeedsSecondPort( display_mode *mode );
91 bool Radeon_DifferentPorts( display_mode *mode );
94 // ProposeDisplayMode.c
95 bool Radeon_GetFormat( int space, int *format, int *bpp );
96 status_t Radeon_CreateModeList( shared_info *si );
99 // dpms.c
100 status_t Radeon_SetDPMS( accelerator_info *ai, int crtc_idx, int mode );
101 uint32 Radeon_GetDPMS( accelerator_info *ai, int crtc_idx );
104 // Cursor.c
105 void Radeon_SetCursorColors( accelerator_info *ai, int crtc_idx );
106 void Radeon_ShowCursor( accelerator_info *ai, int crtc_idx );
109 // Acceleration.c
110 void Radeon_Init2D( accelerator_info *ai );
111 void Radeon_AllocateVirtualCardStateBuffer( accelerator_info *ai );
112 void Radeon_FreeVirtualCardStateBuffer( accelerator_info *ai );
113 void Radeon_FillStateBuffer( accelerator_info *ai, uint32 datatype );
116 // driver_wrapper.c
117 status_t Radeon_WaitForIdle( accelerator_info *ai, bool keep_lock );
118 status_t Radeon_WaitForFifo( accelerator_info *ai, int entries );
119 void Radeon_ResetEngine( accelerator_info *ai );
121 status_t Radeon_VIPRead( accelerator_info *ai, uint channel, uint address, uint32 *data );
122 status_t Radeon_VIPWrite( accelerator_info *ai, uint8 channel, uint address, uint32 data );
123 int Radeon_FindVIPDevice( accelerator_info *ai, uint32 device_id );
126 // settings.cpp
127 void Radeon_ReadSettings( virtual_card *vc );
128 void Radeon_WriteSettings( virtual_card *vc );
131 // overlay.c
132 void Radeon_HideOverlay( accelerator_info *ai );
133 status_t Radeon_UpdateOverlay( accelerator_info *ai );
134 void Radeon_InitOverlay( accelerator_info *ai, int crtc_idx );
136 // EngineManagement.c
137 void Radeon_Spin( uint32 delay );
140 // monitor_detection.c
141 void Radeon_DetectDisplays( accelerator_info *ai );
142 bool Radeon_ReadEDID( accelerator_info *ai, uint32 ddc_port, edid1_info *edid );
145 // palette.c
146 void Radeon_InitPalette( accelerator_info *ai, int crtc_idx );
149 // theatre_out.c
150 void Radeon_DetectTVOut( accelerator_info *ai );
153 #ifdef __cplusplus
155 #endif
157 #endif