1 /* 2 * Copyright 2005, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Lotz <mmlr@mlotz.ch> 7 * Stephan Aßmus <superstippi@gmx.de> 8 */ 9 #ifndef ACCELERANT_HW_INTERFACE_H 10 #define ACCELERANT_HW_INTERFACE_H 11 12 13 #include <image.h> 14 15 #include <Accelerant.h> 16 #include <Locker.h> 17 #include <Region.h> 18 #include <String.h> 19 20 //class MallocBuffer; 21 //class AccelerantBuffer; 22 23 24 class AccelerantHWInterface : public BLocker/* : public HWInterface*/ { 25 public: 26 AccelerantHWInterface(); 27 virtual ~AccelerantHWInterface(); 28 29 virtual status_t Initialize(); 30 virtual status_t Shutdown(); 31 32 /* virtual status_t SetMode(const display_mode &mode); 33 virtual void GetMode(display_mode *mode); 34 35 virtual status_t GetDeviceInfo(accelerant_device_info *info); 36 virtual status_t GetFrameBufferConfig(frame_buffer_config& config); 37 38 virtual status_t GetModeList(display_mode **mode_list, 39 uint32 *count); 40 virtual status_t GetPixelClockLimits(display_mode *mode, 41 uint32 *low, uint32 *high); 42 virtual status_t GetTimingConstraints(display_timing_constraints *dtc); 43 virtual status_t ProposeMode(display_mode *candidate, 44 const display_mode *low, 45 const display_mode *high); 46 47 virtual sem_id RetraceSemaphore(); 48 virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT); 49 50 virtual status_t SetDPMSMode(const uint32 &state); 51 virtual uint32 DPMSMode(); 52 virtual uint32 DPMSCapabilities();*/ 53 54 // query for available hardware accleration and perform it 55 virtual uint32 AvailableHWAcceleration() const; 56 57 virtual void CopyRegion(const clipping_rect* sortedRectList, 58 uint32 count, 59 int32 xOffset, int32 yOffset); 60 virtual void FillRegion(/*const*/ BRegion& region, 61 const rgb_color& color); 62 virtual void InvertRegion(/*const*/ BRegion& region); 63 64 // cursor handling 65 /*virtual void SetCursor(ServerCursor* cursor); 66 virtual void SetCursorVisible(bool visible); 67 virtual void MoveCursorTo(const float& x, 68 const float& y);*/ 69 70 // frame buffer access 71 //virtual RenderingBuffer* FrontBuffer() const; 72 //virtual RenderingBuffer* BackBuffer() const; 73 //virtual bool IsDoubleBuffered() const; 74 75 protected: 76 //virtual void _DrawCursor(BRect area) const; 77 78 private: 79 int _OpenGraphicsDevice(int deviceNumber); 80 status_t _OpenAccelerant(int device); 81 status_t _SetupDefaultHooks(); 82 status_t _UpdateModeList(); 83 status_t _UpdateFrameBufferConfig(); 84 void _RegionToRectParams(/*const*/ BRegion* region, 85 fill_rect_params** params, 86 uint32* count) const; 87 uint32 _NativeColor(const rgb_color& color) const; 88 89 int fCardFD; 90 image_id fAccelerantImage; 91 GetAccelerantHook fAccelerantHook; 92 engine_token *fEngineToken; 93 sync_token fSyncToken; 94 95 // required hooks - guaranteed to be valid 96 acquire_engine fAccAcquireEngine; 97 release_engine fAccReleaseEngine; 98 sync_to_token fAccSyncToToken; 99 accelerant_mode_count fAccGetModeCount; 100 get_mode_list fAccGetModeList; 101 get_frame_buffer_config fAccGetFrameBufferConfig; 102 set_display_mode fAccSetDisplayMode; 103 get_display_mode fAccGetDisplayMode; 104 get_pixel_clock_limits fAccGetPixelClockLimits; 105 106 // optional accelerant hooks 107 get_timing_constraints fAccGetTimingConstraints; 108 propose_display_mode fAccProposeDisplayMode; 109 fill_rectangle fAccFillRect; 110 invert_rectangle fAccInvertRect; 111 screen_to_screen_blit fAccScreenBlit; 112 set_cursor_shape fAccSetCursorShape; 113 move_cursor fAccMoveCursor; 114 show_cursor fAccShowCursor; 115 116 BString fCardNameInDevFS; 117 // dpms hooks 118 /* dpms_capabilities fAccDPMSCapabilities; 119 dpms_mode fAccDPMSMode; 120 set_dpms_mode fAccSetDPMSMode; 121 122 frame_buffer_config fFrameBufferConfig; 123 int fModeCount; 124 display_mode *fModeList;*/ 125 126 127 // MallocBuffer *fBackBuffer; 128 // AccelerantBuffer *fFrontBuffer; 129 130 131 // display_mode fDisplayMode; 132 }; 133 134 #endif // ACCELERANT_HW_INTERFACE_H 135