From 4f212c5d6889495ae03248650b59756d7031edee Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 16 Mar 2019 14:45:53 +0100 Subject: [PATCH] fixedfreq: some renaming, remove members called only once. (nw) --- src/devices/machine/netlist.cpp | 1 + src/devices/video/fixfreq.cpp | 27 +++++---------------------- src/devices/video/fixfreq.h | 25 ++++++++++++++++++++----- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 3c7c7e996a3..97e8667d57e 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -206,6 +206,7 @@ private: netlist::state_var m_last; }; + // ---------------------------------------------------------------------------------------- // Extensions to interface netlist with MAME code .... // ---------------------------------------------------------------------------------------- diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp index c2d67e8c6e1..58eec1722e3 100644 --- a/src/devices/video/fixfreq.cpp +++ b/src/devices/video/fixfreq.cpp @@ -46,7 +46,7 @@ void fixedfreq_monitor_state::update_sync_channel(const time_type &time, const d { //LOG("VSYNC %d %d\n", m_last_x, m_last_y + m_sig_field); m_last_y = m_desc.m_vbackporch - m_desc.m_vsync; - m_intf.update_screen_parameters(time - m_last_vsync_time); + m_intf.vsync_start_cb(time - m_last_vsync_time); m_last_vsync_time = time; } else if (last_vsync && !m_sig_vsync) @@ -79,28 +79,12 @@ void fixedfreq_monitor_state::update_sync_channel(const time_type &time, const d m_last_sync_time = time; } -void fixedfreq_monitor_state::compute_parameters() -{ - - // htotal = m_desc.m_hbackporch; - // vtotal = m_desc.m_vbackporch; - - /* sync separator */ - - m_vsync_threshold = (exp(- 3.0/(3.0+3.0))) - exp(-1.0); - m_vsync_filter_timeconst = (double) (m_desc.m_monitor_clock) / (double) m_desc.m_hbackporch * 1.0; // / (3.0 + 3.0); - //LOG("trigger %f with len %f\n", m_vsync_threshold, 1e6 / m_vsync_filter_timeconst); - - m_clock_period = 1.0 / m_desc.m_monitor_clock; - m_intf.update_screen_parameters(m_clock_period * m_desc.m_vbackporch * m_desc.m_hbackporch); -} - void fixedfreq_monitor_state::update_bm(const time_type &time) { const int pixels = round((time - m_line_time) * m_desc.m_hscale / m_clock_period); const int has_fields = (m_desc.m_fieldcount > 1) ? 1: 0; - uint32_t col(0xFFFF0000); // Mark sync areas + uint32_t col(0xffff0000); // Mark sync areas if (m_sync_signal >= m_desc.m_sync_threshold) col = m_col; @@ -211,8 +195,7 @@ void fixedfreq_device::device_start() m_bitmap[0] = std::make_unique(m_htotal * m_monitor.m_hscale, m_vtotal); m_bitmap[1] = std::make_unique(m_htotal * m_monitor.m_hscale, m_vtotal); - m_state.dev_start_helper(); - m_state.compute_parameters(); + m_state.start(); // FIXME: will be done by netlist going forward save_item(NAME(m_state.m_sync_signal)); @@ -240,7 +223,7 @@ void fixedfreq_device::device_start() void fixedfreq_device::device_reset() { - m_state.dev_reset_helper(); + m_state.reset(); } void fixedfreq_device::device_post_load() @@ -255,7 +238,7 @@ uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bi return 0; } -void fixedfreq_device::update_screen_parameters(double refresh_time) +void fixedfreq_device::vsync_start_cb(double refresh_time) { // toggle bitmap m_cur_bm ^= 1; diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h index decde6fd2a1..d85056d874b 100644 --- a/src/devices/video/fixfreq.h +++ b/src/devices/video/fixfreq.h @@ -59,7 +59,7 @@ struct fixedfreq_monitor_desc struct fixedfreq_monitor_intf { virtual ~fixedfreq_monitor_intf() = default; - virtual void update_screen_parameters(double refresh_time) = 0; + virtual void vsync_start_cb(double refresh_time) = 0; virtual void plot_hline(int x, int y, int w, uint32_t col) = 0; }; @@ -87,7 +87,10 @@ struct fixedfreq_monitor_state m_sig_field(0) {} - void dev_start_helper() + /*** + * \brief To be called after monitor parameters are set + */ + void start() { // FIXME: once moved to netlist this may no longer be necessary. // Only copies constructor init @@ -110,9 +113,22 @@ struct fixedfreq_monitor_state m_sig_vsync = 0; m_sig_composite = 0; m_sig_field = 0; + + // htotal = m_desc.m_hbackporch; + // vtotal = m_desc.m_vbackporch; + + /* sync separator */ + + m_vsync_threshold = (exp(- 3.0/(3.0+3.0))) - exp(-1.0); + m_vsync_filter_timeconst = (double) (m_desc.m_monitor_clock) / (double) m_desc.m_hbackporch * 1.0; // / (3.0 + 3.0); + //LOG("trigger %f with len %f\n", m_vsync_threshold, 1e6 / m_vsync_filter_timeconst); + + m_clock_period = 1.0 / m_desc.m_monitor_clock; + m_intf.vsync_start_cb(m_clock_period * m_desc.m_vbackporch * m_desc.m_hbackporch); + } - void dev_reset_helper() + void reset() { m_last_sync_time = time_type(0); m_line_time = time_type(0); @@ -121,7 +137,6 @@ struct fixedfreq_monitor_state m_vsync_filter = 0; } - void compute_parameters(); void update_sync_channel(const time_type &time, const double newval); void update_bm(const time_type &time); void update_composite_monochrome(const time_type &time, const double newval); @@ -225,7 +240,7 @@ protected: virtual void device_post_load() override; //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - void update_screen_parameters(double refresh_time) override; + void vsync_start_cb(double refresh_time) override; void plot_hline(int x, int y, int w, uint32_t col) override; private: