1 /* 2 Author: 3 Rudolf Cornelissen 7/2004-08/2009 4 */ 5 6 #define MODULE_BIT 0x04000000 7 8 #include "acc_std.h" 9 10 /* Get some info about the device */ 11 status_t GET_ACCELERANT_DEVICE_INFO(accelerant_device_info * adi) 12 { 13 LOG(4,("GET_ACCELERANT_DEVICE_INFO: returning info\n")); 14 15 /* no info on version is provided, so presumably this is for my info */ 16 adi->version = 1; 17 18 sprintf(adi->name, si->adi.name); 19 sprintf(adi->chipset, si->adi.chipset); 20 sprintf(adi->serial_no, "unknown"); 21 adi->memory = si->ps.memory_size; 22 adi->dac_speed = si->ps.max_dac1_clock; 23 24 return B_OK; 25 } 26 27 #ifdef __HAIKU__ 28 29 status_t GET_EDID_INFO(void* info, size_t size, uint32* _version) 30 { 31 if ((!si->ps.crtc1_screen.have_full_edid) && (!si->ps.crtc2_screen.have_full_edid)) { 32 LOG(4,("GET_EDID_INFO: EDID info not available\n")); 33 return B_ERROR; 34 } 35 if (size < sizeof(struct edid1_info)) { 36 LOG(4,("GET_EDID_INFO: not enough memory available\n")); 37 return B_BUFFER_OVERFLOW; 38 } 39 40 LOG(4,("GET_EDID_INFO: returning info\n")); 41 42 /* if we have two screens, make the best of it (go for the best compatible info) */ 43 if ((si->ps.crtc1_screen.have_full_edid) && (si->ps.crtc2_screen.have_full_edid)) { 44 /* return info on screen with lowest aspect (4:3 takes precedence over ws) */ 45 if (si->ps.crtc1_screen.aspect < si->ps.crtc2_screen.aspect) 46 memcpy(info, &si->ps.crtc1_screen.full_edid, sizeof(struct edid1_info)); 47 if (si->ps.crtc1_screen.aspect > si->ps.crtc2_screen.aspect) 48 memcpy(info, &si->ps.crtc2_screen.full_edid, sizeof(struct edid1_info)); 49 50 /* if both screens have the same aspect, return info on the one with 51 * the lowest native resolution */ 52 if (si->ps.crtc1_screen.aspect == si->ps.crtc2_screen.aspect) { 53 if ((si->ps.crtc1_screen.timing.h_display) < (si->ps.crtc2_screen.timing.h_display)) 54 memcpy(info, &si->ps.crtc1_screen.full_edid, sizeof(struct edid1_info)); 55 if ((si->ps.crtc1_screen.timing.h_display) > (si->ps.crtc2_screen.timing.h_display)) 56 memcpy(info, &si->ps.crtc2_screen.full_edid, sizeof(struct edid1_info)); 57 58 /* if both screens have the same resolution and aspect, return info on the 59 * one used as main screen */ 60 if ((si->ps.crtc1_screen.timing.h_display) == (si->ps.crtc2_screen.timing.h_display)) { 61 if (si->ps.crtc2_prim) 62 memcpy(info, &si->ps.crtc2_screen.full_edid, sizeof(struct edid1_info)); 63 else 64 memcpy(info, &si->ps.crtc1_screen.full_edid, sizeof(struct edid1_info)); 65 } 66 } 67 } else { 68 /* there's just one screen of which we have EDID information, return it */ 69 if (si->ps.crtc1_screen.have_full_edid) 70 memcpy(info, &si->ps.crtc1_screen.full_edid, sizeof(struct edid1_info)); 71 else 72 memcpy(info, &si->ps.crtc2_screen.full_edid, sizeof(struct edid1_info)); 73 } 74 75 *_version = EDID_VERSION_1; 76 return B_OK; 77 } 78 79 #endif // __HAIKU__ 80