diff --git a/src/add-ons/accelerants/radeon/GetAccelerantHook.c b/src/add-ons/accelerants/radeon/GetAccelerantHook.c index 816d3b59f9..416d9f0f6c 100644 --- a/src/add-ons/accelerants/radeon/GetAccelerantHook.c +++ b/src/add-ons/accelerants/radeon/GetAccelerantHook.c @@ -1,14 +1,13 @@ /* - Copyright (c) 2002, Thomas Kurschel - + * Copyright (c) 2002, Thomas Kurschel + * Distributed under the terms of the MIT License. + */ - Part of Radeon accelerant - +/*! Contains entry point to get public functions. (directly copied from sample driver) */ - #include "generic.h" /* @@ -22,9 +21,11 @@ is available. Any extra information available to choose the function will be noted on a case by case below. */ -void * get_accelerant_hook(uint32 feature, void *data) { +void * +get_accelerant_hook(uint32 feature, void *data) +{ (void)data; - + switch (feature) { /* These definitions are out of pure lazyness. @@ -59,6 +60,8 @@ initialization process. HOOK(MOVE_DISPLAY); HOOK(SET_INDEXED_COLORS); //HOOK(GET_TIMING_CONSTRAINTS); + case B_GET_EDID_INFO: + return (void*)radeon_get_edid_info; HOOK(DPMS_CAPABILITIES); HOOK(DPMS_MODE); @@ -103,8 +106,6 @@ the same function all the time. #undef HOOK #undef ZERO } -/* -Return a null pointer for any feature we don't understand. -*/ - return 0; + + return NULL; } diff --git a/src/add-ons/accelerants/radeon/GetModeInfo.c b/src/add-ons/accelerants/radeon/GetModeInfo.c index f461d1d42d..7ffded799f 100644 --- a/src/add-ons/accelerants/radeon/GetModeInfo.c +++ b/src/add-ons/accelerants/radeon/GetModeInfo.c @@ -1,52 +1,52 @@ /* - Copyright (c) 2002, Thomas Kurschel - + * Copyright (c) 2002, Thomas Kurschel + * Distributed under the terms of the MIT License. + */ - Part of Radeon accelerant - - Public mode-specific info functions -*/ +/*! Public mode-specific info functions */ #include "radeon_accelerant.h" #include "GlobalData.h" #include "generic.h" + #include -// public function: return current display mode -status_t GET_DISPLAY_MODE( display_mode *current_mode ) +status_t +GET_DISPLAY_MODE(display_mode *mode) { virtual_card *vc = ai->vc; - + // TBD: there is a race condition if someone else is just setting it // we won't lock up but return non-sense - *current_mode = vc->mode; - + *mode = vc->mode; + // we hide multi-monitor-mode because :- // - we want to look like an ordinary single-screen driver // - the multi-mode is already adapted to current screen configuration, // and the mode should be configuration-independant - Radeon_HideMultiMode( vc, current_mode ); - + Radeon_HideMultiMode(vc, mode); return B_OK; } -// public function: return configuration of frame buffer -status_t GET_FRAME_BUFFER_CONFIG( frame_buffer_config *afb ) + +status_t +GET_FRAME_BUFFER_CONFIG(frame_buffer_config *afb) { virtual_card *vc = ai->vc; // TBD: race condition again - + // easy again, as the last mode set stored the info in a convienient form *afb = vc->fbc; return B_OK; } -// public function: return clock limits for given display mode -status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high) + +status_t +GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high) { // we ignore stuff like DVI/LCD restrictions - // they are handled automatically on set_display_mode @@ -62,11 +62,38 @@ status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high) return B_OK; } + +#ifdef __HAIKU__ + +status_t +radeon_get_edid_info(void* info, size_t size, uint32* _version) +{ + disp_entity* routes = &ai->si->routing; + int32 index; + + if (size < sizeof(struct edid1_info)) + return B_BUFFER_OVERFLOW; + + if (routes->port_info[0].edid_valid) + index = 0; + else if (routes->port_info[1].edid_valid) + index = 1; + else + return B_ERROR; + + memcpy(info, &routes->port_info[index].edid, sizeof(struct edid1_info)); + *_version = EDID_VERSION_1; + return B_OK; +} + +#endif // __HAIKU__ + /* Return the semaphore id that will be used to signal a vertical retrace occured. */ -sem_id ACCELERANT_RETRACE_SEMAPHORE(void) +sem_id +ACCELERANT_RETRACE_SEMAPHORE(void) { virtual_card *vc = ai->vc; @@ -80,15 +107,14 @@ sem_id ACCELERANT_RETRACE_SEMAPHORE(void) // with multi-monitor mode, we have two vertical blanks! // until we find a better solution, we always return virtual port 0, // which may be either physical port 0 or 1 - int crtc_idx; - + int crtcIndex; + if( vc->used_crtc[0] ) - crtc_idx = 0; + crtcIndex = 0; else - crtc_idx = 1; - + crtcIndex = 1; + //SHOW_INFO( 3, "semaphore: %x", ai->si->ports[physical_port].vblank ); - - return ai->si->crtc[crtc_idx].vblank; - //return B_ERROR; + + return ai->si->crtc[crtcIndex].vblank; } diff --git a/src/add-ons/accelerants/radeon/generic.h b/src/add-ons/accelerants/radeon/generic.h index afc31a4196..51ce54e0ff 100644 --- a/src/add-ons/accelerants/radeon/generic.h +++ b/src/add-ons/accelerants/radeon/generic.h @@ -27,6 +27,7 @@ status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high); status_t MOVE_DISPLAY(uint16 h_display_start, uint16 v_display_start); status_t GET_TIMING_CONSTRAINTS(display_timing_constraints *dtc); void SET_INDEXED_COLORS(uint count, uint8 first, uint8 *color_data, uint32 flags); +status_t radeon_get_edid_info(void* info, size_t size, uint32* _version); uint32 DPMS_CAPABILITIES(void); uint32 DPMS_MODE(void);