added memory bandwidth check for overlay support decisions

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14177 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2005-09-13 12:34:03 +00:00
parent 402e2a2eef
commit c75aba1bee
3 changed files with 73 additions and 11 deletions

View File

@ -90,15 +90,15 @@ void * get_accelerant_hook(uint32 feature, void *data)
*/
/* only export video overlay functions if card is capable of it */
// CHKO(OVERLAY_COUNT);
// CHKO(OVERLAY_SUPPORTED_SPACES);
// CHKO(OVERLAY_SUPPORTED_FEATURES);
// CHKO(ALLOCATE_OVERLAY_BUFFER);
// CHKO(RELEASE_OVERLAY_BUFFER);
// CHKO(GET_OVERLAY_CONSTRAINTS);
// CHKO(ALLOCATE_OVERLAY);
// CHKO(RELEASE_OVERLAY);
// CHKO(CONFIGURE_OVERLAY);
CHKO(OVERLAY_COUNT);
CHKO(OVERLAY_SUPPORTED_SPACES);
CHKO(OVERLAY_SUPPORTED_FEATURES);
CHKO(ALLOCATE_OVERLAY_BUFFER);
CHKO(RELEASE_OVERLAY_BUFFER);
CHKO(GET_OVERLAY_CONSTRAINTS);
CHKO(ALLOCATE_OVERLAY);
CHKO(RELEASE_OVERLAY);
CHKO(CONFIGURE_OVERLAY);
/*
When requesting an acceleration hook, the calling application provides a
@ -170,8 +170,11 @@ status_t check_overlay_capability(uint32 feature)
break;
}
/* all supported cards have a bes */
LOG(4, ("Overlay: Exporting hook %s.\n", msg));
/* all supported cards have a bes, but it can't always be used... */
if (eng_bes_chk_bandwidth())
LOG(4, ("Overlay: Exporting hook %s.\n", msg));
else
LOG(4, ("Overlay: Not exporting hook %s.\n", msg));
return B_OK;
}

View File

@ -19,6 +19,64 @@ struct move_overlay_info
static void eng_bes_calc_move_overlay(move_overlay_info *moi);
static void eng_bes_program_move_overlay(move_overlay_info moi);
/* returns true if the current displaymode leaves enough bandwidth for overlay
* support, false if not. */
bool eng_bes_chk_bandwidth()
{
float refresh, bandwidth;
uint8 depth;
switch(si->dm.space)
{
case B_CMAP8: depth = 8; break;
case B_RGB15_LITTLE: depth = 16; break;
case B_RGB16_LITTLE: depth = 16; break;
case B_RGB32_LITTLE: depth = 32; break;
default:
LOG(8,("Overlay: Invalid colour depth 0x%08x\n", si->dm.space));
return false;
}
refresh =
(si->dm.timing.pixel_clock * 1000) /
(si->dm.timing.h_total * si->dm.timing.v_total);
bandwidth =
si->dm.timing.h_display * si->dm.timing.v_display * refresh * depth;
LOG(8,("Overlay: Current mode's refreshrate is %.2fHz, bandwidth is %.0f\n",
refresh, bandwidth));
switch (((CRTCR(MEMCLK)) & 0x70) >> 4)
{
case 0: /* SDR 66 */
case 1: /* SDR 100 */
case 2: /* SDR 133 */
/* memory is too slow, sorry. */
return false;
break;
case 3: /* DDR 100 */
/* DDR100's basic limit... */
if (bandwidth > 921600000.0) return false;
/* ... but we have constraints at higher than 800x600 */
if (si->dm.timing.h_display > 800)
{
if (depth != 8) return false;
if (si->dm.timing.v_display > 768) return false;
if (refresh > 60.2) return false;
}
break;
case 4: /* DDR 133 */
if (bandwidth > 4045440000.0) return false;
break;
default: /* not (yet?) used */
return false;
break;
}
//fixme: temporary (implement overlay first)
// return true;
return false;
}
/* move the overlay output window in virtualscreens */
/* Note:
* si->dm.h_display_start and si->dm.v_display_start determine where the new

View File

@ -115,6 +115,7 @@ status_t eng_acc_wait_idle(void);
/* backend scaler functions */
status_t check_overlay_capability(uint32 feature);
bool eng_bes_chk_bandwidth(void);
void eng_bes_move_overlay(void);
status_t eng_bes_to_crtc(bool crtc);
status_t eng_bes_init(void);