vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / intel_extreme / accelerant.h
blob0b34dda2f1c647a6ab56087eaceb62cff5a111ed
1 /*
2 * Copyright 2006-2008, 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 */
8 #ifndef INTEL_EXTREME_ACCELERANT_H
9 #define INTEL_EXTREME_ACCELERANT_H
12 #include "intel_extreme.h"
14 #include <edid.h>
15 #include <video_overlay.h>
17 #include "Ports.h"
18 #include "Pipes.h"
21 struct overlay {
22 overlay_buffer buffer;
23 addr_t buffer_base;
24 uint32 buffer_offset;
25 addr_t state_base;
26 uint32 state_offset;
29 struct overlay_frame {
30 int16 h_start;
31 int16 v_start;
32 uint16 width;
33 uint16 height;
36 struct accelerant_info {
37 uint8* registers;
38 area_id regs_area;
40 intel_shared_info* shared_info;
41 area_id shared_info_area;
43 display_mode current_mode; // pretty much a hack until per-display modes
45 display_mode* mode_list; // cloned list of standard display modes
46 area_id mode_list_area;
48 struct overlay_registers* overlay_registers;
49 overlay* current_overlay;
50 overlay_view last_overlay_view;
51 overlay_frame last_overlay_frame;
52 uint32 last_horizontal_overlay_scale;
53 uint32 last_vertical_overlay_scale;
54 uint32 overlay_position_buffer_offset;
56 uint32 port_count;
57 Port* ports[MAX_PORTS];
59 uint32 pipe_count;
60 Pipe* pipes[MAX_PIPES];
62 edid1_info edid_info;
63 bool has_edid;
65 // limited 3D support for overlay on i965
66 addr_t context_base;
67 uint32 context_offset;
68 bool context_set;
70 int device;
71 uint8 head_mode;
72 bool is_clone;
76 #define HEAD_MODE_A_ANALOG 0x0001
77 #define HEAD_MODE_B_DIGITAL 0x0002
78 #define HEAD_MODE_CLONE 0x0003
79 #define HEAD_MODE_LVDS_PANEL 0x0008
80 #define HEAD_MODE_TESTING 0x1000
81 #define HEAD_MODE_STIPPI 0x2000
83 extern accelerant_info* gInfo;
85 // register access
87 inline uint32
88 read32(uint32 encodedRegister)
90 return *(volatile uint32*)(gInfo->registers
91 + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)]
92 + REGISTER_REGISTER(encodedRegister));
95 inline void
96 write32(uint32 encodedRegister, uint32 value)
98 *(volatile uint32*)(gInfo->registers
99 + gInfo->shared_info->register_blocks[REGISTER_BLOCK(encodedRegister)]
100 + REGISTER_REGISTER(encodedRegister)) = value;
103 void dump_registers(void);
105 // dpms.cpp
106 extern void enable_display_plane(bool enable);
107 extern void set_display_power_mode(uint32 mode);
109 // engine.cpp
110 extern void uninit_ring_buffer(ring_buffer &ringBuffer);
111 extern void setup_ring_buffer(ring_buffer &ringBuffer, const char* name);
113 // modes.cpp
114 extern void wait_for_vblank(void);
115 extern void set_frame_buffer_base(void);
116 extern status_t create_mode_list(void);
118 // memory.cpp
119 extern void intel_free_memory(addr_t base);
120 extern status_t intel_allocate_memory(size_t size, uint32 flags, addr_t &base);
122 #endif /* INTEL_EXTREME_ACCELERANT_H */