1 /* 2 * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 #ifndef INTEL_EXTREME_ACCELERANT_H 9 #define INTEL_EXTREME_ACCELERANT_H 10 11 12 #include "intel_extreme.h" 13 14 #include <edid.h> 15 #include <video_overlay.h> 16 17 18 struct overlay { 19 overlay_buffer buffer; 20 uint32 buffer_handle; 21 uint32 buffer_offset; 22 }; 23 24 struct overlay_frame { 25 int16 h_start; 26 int16 v_start; 27 uint16 width; 28 uint16 height; 29 }; 30 31 struct accelerant_info { 32 vuint8 *regs; 33 area_id regs_area; 34 35 intel_shared_info *shared_info; 36 area_id shared_info_area; 37 38 display_mode *mode_list; // cloned list of standard display modes 39 area_id mode_list_area; 40 41 uint32 frame_buffer_handle; 42 43 struct overlay_registers *overlay_registers; 44 overlay *current_overlay; 45 overlay_view last_overlay_view; 46 overlay_frame last_overlay_frame; 47 uint32 last_horizontal_overlay_scale; 48 uint32 last_vertical_overlay_scale; 49 uint32 overlay_position_buffer_offset; 50 51 hardware_status *status; 52 uint8 *cursor_memory; 53 54 edid1_info edid_info; 55 bool has_edid; 56 57 int device; 58 uint8 head_mode; 59 bool is_clone; 60 }; 61 62 #define HEAD_MODE_A_ANALOG 0x01 63 #define HEAD_MODE_B_DIGITAL 0x02 64 #define HEAD_MODE_CLONE 0x03 65 66 extern accelerant_info *gInfo; 67 68 // register access 69 70 inline uint32 71 read32(uint32 offset) 72 { 73 return *(volatile uint32 *)(gInfo->regs + offset); 74 } 75 76 inline void 77 write32(uint32 offset, uint32 value) 78 { 79 *(volatile uint32 *)(gInfo->regs + offset) = value; 80 } 81 82 83 // dpms.cpp 84 extern void enable_display_plane(bool enable); 85 extern void set_display_power_mode(uint32 mode); 86 87 // engine.cpp 88 extern void uninit_ring_buffer(ring_buffer &ringBuffer); 89 extern void setup_ring_buffer(ring_buffer &ringBuffer, const char *name); 90 91 // modes.cpp 92 extern void wait_for_vblank(void); 93 extern void set_frame_buffer_base(void); 94 extern status_t create_mode_list(void); 95 96 // memory.cpp 97 extern void intel_free_memory(uint32 handle); 98 extern status_t intel_allocate_memory(size_t size, uint32& handle, uint32& offset); 99 100 #endif /* INTEL_EXTREME_ACCELERANT_H */ 101