Beispiel #1
0
bool vsync_busywait_do (int *freetime, bool lace, bool oddeven)
{
	bool v;
	static bool framelost;
	int ti;
	frame_time_t t;
	frame_time_t prevtime = vblank_prev_time;
	struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];

	t = read_processor_time ();
	ti = t - prevtime;
	if (ti) {
		waitvblankstate (false, NULL, NULL);
		vblank_prev_time = t;

		return true;
	}

	if (freetime)
		*freetime = 0;
	v = 0;

	if (isthreadedvsync ()) {

		framelost = false;
		v = 1;

	} else {
		int vp;

		if (currprefs.turbo_emulation) {
			show_screen (0);
			vblank_prev_time = read_processor_time ();
			framelost = true;
			v = -1;

		} else {
			while (!framelost && read_processor_time () - prevtime < 0) {
				vsync_sleep (false);
			}
			vp = vblank_wait ();
			if (vp >= -1) {
				vblank_prev_time = read_processor_time ();
				if (ap->gfx_vflip == 0) {
					show_screen (0);
				}
				for (;;) {
					if (!getvblankpos (&vp))
						break;
					if (vp > 0)
						break;
					sleep_millis (1);
				}
				if (ap->gfx_vflip != 0) {
					show_screen (0);
				}
				v = framelost ? -1 : 1;
			}

			framelost = false;
		}
		getvblankpos (&vp);
	}

		return v;
	}
Beispiel #2
0
int vsync_busywait_do (int *freetime, bool lace, bool oddeven) {
    UAE_LOG_STUB("");
    return false;
#if 0
    bool v;
    static bool framelost;
    int ti;
    frame_time_t t;
    frame_time_t prevtime = vblank_prev_time;

    dooddevenskip = false;

    if (lace)
        vblankbaselace_chipset = oddeven;
    else
        vblankbaselace_chipset = -1;

    t = read_processor_time ();
    ti = t - prevtime;
    //if (ti > 2 * vblankbasefull || ti < -2 * vblankbasefull) {
    if (ti > 1 * vblankbasefull || ti < -1 * vblankbasefull) {
#if 0
        waitvblankstate (false, NULL);
#endif
        t = read_processor_time ();
        vblank_prev_time = t;
        thread_vblank_time = t;
        frame_missed++;
        return true;
    }

    //if (log_vsync) {
    //    console_out_f(_T("F:%8d M:%8d E:%8d %3d%% (%3d%%) %10d\r"), frame_counted, frame_missed, frame_errors, frame_usage, frame_usage_avg, (t - vblank_prev_time) - vblankbasefull);
    //}

    if (freetime)
        *freetime = 0;
    if (currprefs.turbo_emulation) {
        frame_missed++;
        return true;
    }
#if 0
    frame_usage = (t - prevtime) * 100 / vblankbasefull;
    if (frame_usage > 99)
        frame_usage = 99;
    else if (frame_usage < 0)
        frame_usage = 0;
    frame_usage_total += frame_usage;
    if (freetime)
        *freetime = frame_usage;
    if (frame_counted)
        frame_usage_avg = frame_usage_total / frame_counted;
#endif
    v = false;

    if (isthreadedvsync ()) {

        framelost = false;
        v = true;

    } else {
#if 0
        bool doskip = false;

        if (!framelost && t - prevtime > vblankbasefull) {
            framelost = true;
            frame_missed++;
            return true;
        }

        if (vblanklaceskip ()) {
            doskip = true;
            dooddevenskip = true;
        }

        if (!doskip) {
            while (!framelost && read_processor_time () - prevtime < vblankbasewait1) {
                vsync_sleep (false);
            }
            v = vblank_wait ();
        } else {
            v = true;
        }
        framelost = false;
#endif
    }

    if (v) {
        vblank_prev_time = read_processor_time ();
        frame_counted++;
        return true;
    }
    frame_errors++;
    return false;
#endif
}