mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-08-12 06:25:32 +00:00
Improve heuristic for VOSF profitability: we should not spend more than
the half of a video interrupt quantum for updating the screen. Also improve the wording of the result.
This commit is contained in:
@@ -218,12 +218,12 @@ static uint32 page_extend(uint32 size)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const int VOSF_PROFITABLE_TRIES = 3; // Make 3 attempts for full screen update
|
const int VOSF_PROFITABLE_TRIES = 3; // Make 3 attempts for full screen update
|
||||||
const int VOSF_PROFITABLE_THRESHOLD = 16667; // 60 Hz
|
const int VOSF_PROFITABLE_THRESHOLD = 16667/2; // 60 Hz (half of the quantum)
|
||||||
|
|
||||||
static bool video_vosf_profitable(void)
|
static bool video_vosf_profitable(void)
|
||||||
{
|
{
|
||||||
int64 durations[VOSF_PROFITABLE_TRIES];
|
uint32 duration = 0;
|
||||||
int mean_duration = 0;
|
const uint32 n_page_faults = mainBuffer.pageCount * VOSF_PROFITABLE_TRIES;
|
||||||
|
|
||||||
#ifdef SHEEPSHAVER
|
#ifdef SHEEPSHAVER
|
||||||
const bool accel = PrefsFindBool("gfxaccel");
|
const bool accel = PrefsFindBool("gfxaccel");
|
||||||
@@ -240,9 +240,8 @@ static bool video_vosf_profitable(void)
|
|||||||
else
|
else
|
||||||
addr[0] = 0; // Trigger Screen_fault_handler()
|
addr[0] = 0; // Trigger Screen_fault_handler()
|
||||||
}
|
}
|
||||||
int64 duration = GetTicks_usec() - start;
|
uint64 elapsed = GetTicks_usec() - start;
|
||||||
mean_duration += duration;
|
duration += elapsed;
|
||||||
durations[i] = duration;
|
|
||||||
|
|
||||||
PFLAG_CLEAR_ALL;
|
PFLAG_CLEAR_ALL;
|
||||||
mainBuffer.dirty = false;
|
mainBuffer.dirty = false;
|
||||||
@@ -250,9 +249,8 @@ static bool video_vosf_profitable(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mean_duration /= VOSF_PROFITABLE_TRIES;
|
D(bug("Triggered %d page faults in %ld usec (%.1f usec per fault)\n", n_page_faults, duration, double(duration) / double(n_page_faults)));
|
||||||
D(bug("Triggered %d screen faults in %ld usec on average\n", mainBuffer.pageCount, mean_duration));
|
return ((duration / VOSF_PROFITABLE_TRIES) < (VOSF_PROFITABLE_THRESHOLD * (frame_skip ? frame_skip : 1)));
|
||||||
return (mean_duration < (VOSF_PROFITABLE_THRESHOLD * (frame_skip ? frame_skip : 1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user