1 /* 2 Copyright (c) 2002, Thomas Kurschel 3 4 5 Part of Radeon accelerant 6 7 Public mode-specific info functions 8 */ 9 10 11 #include "radeon_accelerant.h" 12 #include "GlobalData.h" 13 #include "generic.h" 14 #include <sys/ioctl.h> 15 #include <GraphicsDefs.h> 16 17 18 // public function: return current display mode 19 status_t GET_DISPLAY_MODE( display_mode *current_mode ) 20 { 21 virtual_card *vc = ai->vc; 22 23 // TBD: there is a race condition if someone else is just setting it 24 // we won't lock up but return non-sense 25 26 *current_mode = vc->mode; 27 28 // we hide multi-monitor-mode because :- 29 // - we want to look like an ordinary single-screen driver 30 // - the multi-mode is already adapted to current screen configuration, 31 // and the mode should be configuration-independant 32 Radeon_HideMultiMode( vc, current_mode ); 33 34 return B_OK; 35 } 36 37 // public function: return configuration of frame buffer 38 status_t GET_FRAME_BUFFER_CONFIG( frame_buffer_config *afb ) 39 { 40 virtual_card *vc = ai->vc; 41 42 // TBD: race condition again 43 44 // easy again, as the last mode set stored the info in a convienient form 45 *afb = vc->fbc; 46 return B_OK; 47 } 48 49 // public function: return clock limits for given display mode 50 status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high) 51 { 52 // we ignore stuff like DVI/LCD restrictions - 53 // they are handled automatically on set_display_mode 54 uint32 total_pix = (uint32)dm->timing.h_total * (uint32)dm->timing.v_total; 55 uint32 clock_limit = ai->si->pll.max_pll_freq * 10; 56 57 /* lower limit of about 48Hz vertical refresh */ 58 *low = (total_pix * 48L) / 1000L; 59 if (*low > clock_limit) 60 return B_ERROR; 61 62 *high = clock_limit; 63 return B_OK; 64 } 65 66 /* 67 Return the semaphore id that will be used to signal a vertical retrace 68 occured. 69 */ 70 sem_id ACCELERANT_RETRACE_SEMAPHORE(void) 71 { 72 // virtual_card *vc = ai->vc; 73 74 /* 75 NOTE: 76 The kernel driver created this for us. We don't know if the system is 77 using real interrupts, or if we're faking it, and we don't care. 78 If we choose not to support this at all, we'd just return B_ERROR here, 79 and the user wouldn't get any kind of vertical retrace support. 80 */ 81 // with multi-monitor mode, we have two vertical blanks! 82 // until we find a better solution, we always return virtual port 0, 83 // which may be either physical port 0 or 1 84 // int physical_port = vc->ports[0].physical_port; 85 86 //SHOW_INFO( 3, "semaphore: %x", ai->si->ports[physical_port].vblank ); 87 88 //return ai->si->ports[physical_port].vblank; 89 return 0; 90 } 91