mame: upgrade 0207 -> 0208

patches made into release announcement :)))

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2019-03-28 07:22:32 +01:00
parent f7ed4d9e73
commit d531df3af0
9 changed files with 2 additions and 725 deletions

View File

@@ -1,43 +0,0 @@
From 20d22d8ccd644698a0103ddf116e97c3f365a98d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Tue, 26 Feb 2019 08:35:46 +0100
Subject: [PATCH] pokey: performance optimization by not using modulus
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream-Status: Backport [1]
[1] https://github.com/mamedev/mame/commit/d67456f6717faf7f06f422d1e8f1017650aeac46
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 9afe7e8dba..6cd63dca93 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -589,10 +589,14 @@ uint32_t pokey_device::step_one_clock(void)
}
}
- m_p4 = (m_p4 + 1) % 0x0000f;
- m_p5 = (m_p5 + 1) % 0x0001f;
- m_p9 = (m_p9 + 1) % 0x001ff;
- m_p17 = (m_p17 + 1 ) % 0x1ffff;
+ if (++m_p4 >= 0x0000f)
+ m_p4 = 0;
+ if (++m_p5 >= 0x0001f)
+ m_p5 = 0;
+ if (++m_p9 >= 0x001ff)
+ m_p9 = 0;
+ if (++m_p17 >= 0x1ffff)
+ m_p17 = 0;
clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
if (clock_triggered[clk])
--
2.20.1

View File

@@ -1,120 +0,0 @@
From a3d247fe91a97f76461ff1528bc69cae6920d772 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Fri, 1 Mar 2019 00:35:13 +0100
Subject: [PATCH 1/2] pokey: rename pokey_device::m_output ->
pokey_device::m_out_raw
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is a variable pokey_device::pokey_channel::m_output. Two variables with
same name in close context but complete different maning are not exactly
helpful to understand the code.
renaming pokey_device::pokey_channel::m_output was not an option because this
would damage stored machine states - right?
Upstream-Status: Applied [1]
[1] https://github.com/mamedev/mame/pull/4702
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 18 +++++++++---------
src/devices/sound/pokey.h | 6 +++---
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index a7f175ddd1..08806da558 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -253,7 +253,7 @@ void pokey_device::device_start()
m_pot_counter = 0;
m_kbd_cnt = 0;
m_out_filter = 0;
- m_output = 0;
+ m_out_raw = 0;
m_kbd_state = 0;
/* reset more internal state */
@@ -436,11 +436,11 @@ void pokey_device::execute_run()
do
{
uint32_t new_out = step_one_clock();
- if (m_output != new_out)
+ if (m_out_raw != new_out)
{
- //printf("forced update %08d %08x\n", m_icount, m_output);
+ //printf("forced update %08d %08x\n", m_icount, m_out_raw);
m_stream->update();
- m_output = new_out;
+ m_out_raw = new_out;
}
m_icount--;
@@ -704,7 +704,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
{
int32_t out = 0;
for (int i = 0; i < 4; i++)
- out += ((m_output >> (4*i)) & 0x0f);
+ out += ((m_out_raw >> (4*i)) & 0x0f);
out *= POKEY_DEFAULT_GAIN;
out = (out > 0x7fff) ? 0x7fff : out;
while( samples > 0 )
@@ -715,7 +715,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == RC_LOWPASS)
{
- double rTot = m_voltab[m_output];
+ double rTot = m_voltab[m_out_raw];
double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.0 * 32767.0;
double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-(rTot + m_r_pullup) / (m_cap * m_r_pullup * rTot) * m_clock_period.as_double());
@@ -731,7 +731,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == OPAMP_C_TO_GROUND)
{
- double rTot = m_voltab[m_output];
+ double rTot = m_voltab[m_out_raw];
/* In this configuration there is a capacitor in parallel to the pokey output to ground.
* With a LM324 in LTSpice this causes the opamp circuit to oscillate at around 100 kHz.
* We are ignoring the capacitor here, since this oscillation would not be audible.
@@ -753,7 +753,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == OPAMP_LOW_PASS)
{
- double rTot = m_voltab[m_output];
+ double rTot = m_voltab[m_out_raw];
/* This post-pokey stage usually has a low-pass filter behind it
* It is approximated by not adding in VRef below.
*/
@@ -771,7 +771,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == DISCRETE_VAR_R)
{
- int32_t out = m_voltab[m_output];
+ int32_t out = m_voltab[m_out_raw];
while( samples > 0 )
{
*buffer++ = out;
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index 0fa9e21a17..e4498def7b 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -284,10 +284,10 @@ private:
pokey_channel m_channel[POKEY_CHANNELS];
- uint32_t m_output; /* raw output */
- double m_out_filter; /* filtered output */
+ uint32_t m_out_raw; /* raw output */
+ double m_out_filter; /* filtered output */
- int32_t m_clock_cnt[3]; /* clock counters */
+ int32_t m_clock_cnt[3]; /* clock counters */
uint32_t m_p4; /* poly4 index */
uint32_t m_p5; /* poly5 index */
uint32_t m_p9; /* poly9 index */
--
2.20.1

View File

@@ -1,190 +0,0 @@
From b6ad431ff6acc5d12ba51ed64242a5f61e2c87bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Fri, 1 Mar 2019 12:27:23 +0100
Subject: [PATCH 2/2] pokey: rework for performance enhancements
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Profiling with valgrind pointed to the following hotspot:
pokey_device::step_one_clock / line 686-689:
| for (int ch = 0; ch < 4; ch++)
| {
| sum |= (((((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? (m_channel[ch].m_AUDC & VOLUME_MASK) : 0 )) << (ch * 4));
| }
First solution was to move bit-shifting to first part of ?-part:
| sum |= (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? ((m_channel[ch].m_AUDC & VOLUME_MASK) << (ch * 4)) : 0);
because shifting 0 does not change value. Performance measurements showed
improvements but they were not satisfying exactly (change is part of this
patch).
So I thought more of what this piece of code is about:
* it is run at high frequency (@starwars: 1.5MHz * 4 pokey instances *
4 channels -> ~6MHz)
=> that is creating the high CPU cycle consumption
* frequency of output change is in a range of (double) audible frequencies (few
kHz).
=> there are long sequences creating identical output
* the sum value calculated depends on few channel input variables: m_output /
m_filter_sample / m_AUDC
This patch suggests a solution which keeps track of possible input variable
change and as long as they don't change there is no need to render output sum.
The following tests were performed:
* mame64 -bench 50 starwars: Average speed increases from ~430 to ~490 on my PC
* starwars, missile-command and marble-madness do not show any audible
artefacts
Upstream-Status: Applied [1]
[1] https://github.com/mamedev/mame/pull/4702
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 38 +++++++++++++++++++++++--------------
src/devices/sound/pokey.h | 3 ++-
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 08806da558..03ea12c7b5 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -254,6 +254,7 @@ void pokey_device::device_start()
m_kbd_cnt = 0;
m_out_filter = 0;
m_out_raw = 0;
+ m_old_raw_inval = true;
m_kbd_state = 0;
/* reset more internal state */
@@ -435,14 +436,7 @@ void pokey_device::execute_run()
{
do
{
- uint32_t new_out = step_one_clock();
- if (m_out_raw != new_out)
- {
- //printf("forced update %08d %08x\n", m_icount, m_out_raw);
- m_stream->update();
- m_out_raw = new_out;
- }
-
+ step_one_clock();
m_icount--;
} while (m_icount > 0);
@@ -570,7 +564,7 @@ void pokey_device::step_pot()
*
*/
-uint32_t pokey_device::step_one_clock(void)
+void pokey_device::step_one_clock(void)
{
int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
@@ -682,12 +676,23 @@ uint32_t pokey_device::step_one_clock(void)
m_channel[CHAN1].m_filter_sample = 1;
}
- uint32_t sum = 0;
- for (int ch = 0; ch < 4; ch++)
+ if (m_old_raw_inval)
{
- sum |= (((((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? (m_channel[ch].m_AUDC & VOLUME_MASK) : 0 )) << (ch * 4));
+ uint32_t sum = 0;
+ for (int ch = 0; ch < 4; ch++)
+ {
+ sum |= (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ?
+ ((m_channel[ch].m_AUDC & VOLUME_MASK) << (ch * 4)) : 0);
+ }
+
+ if (m_out_raw != sum)
+ {
+ //printf("forced update %08d %08x\n", m_icount, m_out_raw);
+ m_stream->update();
+ }
+ m_old_raw_inval = false;
+ m_out_raw = sum;
}
- return sum;
}
//-------------------------------------------------
@@ -898,6 +903,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC1_C:
LOG_SOUND(("POKEY '%s' AUDC1 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN1].m_AUDC = data;
+ m_old_raw_inval = true;
break;
case AUDF2_C:
@@ -908,6 +914,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC2_C:
LOG_SOUND(("POKEY '%s' AUDC2 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN2].m_AUDC = data;
+ m_old_raw_inval = true;
break;
case AUDF3_C:
@@ -918,6 +925,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC3_C:
LOG_SOUND(("POKEY '%s' AUDC3 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN3].m_AUDC = data;
+ m_old_raw_inval = true;
break;
case AUDF4_C:
@@ -928,6 +936,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC4_C:
LOG_SOUND(("POKEY '%s' AUDC4 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN4].m_AUDC = data;
+ m_old_raw_inval = true;
break;
case AUDCTL_C:
@@ -952,7 +961,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
m_channel[i].m_output = 0;
m_channel[i].m_filter_sample = (i<2 ? 1 : 0);
}
-
+ m_old_raw_inval = true;
break;
case SKREST_C:
@@ -1070,6 +1079,7 @@ inline void pokey_device::process_channel(int ch)
m_channel[ch].m_output = (m_poly9[m_p9] & 1);
else
m_channel[ch].m_output = (m_poly17[m_p17] & 1);
+ m_old_raw_inval = true;
}
}
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index e4498def7b..7e63e89e54 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -264,7 +264,7 @@ private:
static constexpr int POKEY_CHANNELS = 4;
- uint32_t step_one_clock();
+ void step_one_clock();
void step_keyboard();
void step_pot();
@@ -285,6 +285,7 @@ private:
pokey_channel m_channel[POKEY_CHANNELS];
uint32_t m_out_raw; /* raw output */
+ bool m_old_raw_inval; /* true: recalc m_out_raw required */
double m_out_filter; /* filtered output */
int32_t m_clock_cnt[3]; /* clock counters */
--
2.20.1

View File

@@ -1,94 +0,0 @@
From ff13f1d34ae9ad68ee5e50a138d794cb402817ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Sun, 3 Mar 2019 21:50:21 +0100
Subject: [PATCH] pokey: rework prescaler handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* CLK_1 does not have a prescaler so there is no need to increment and reset
m_clock_cnt[CLK_1]
* Unroll other prescalers: It gives performance win and reading is easier.
Function tests: on missile/starwars
Performance test: mame64 -nothrottle starwars
Before: Average speed: 409.36% (21 seconds)
After: Average speed: 447.37% (21 seconds)
Upstream-Status: Applied [1]
[1] https://github.com/mamedev/mame/pull/4702
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 03ea12c7b5..231dc01e8b 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -161,8 +161,6 @@
#define CLK_28 1
#define CLK_114 2
-static const int clock_divisors[3] = {1, DIV_64, DIV_15};
-
constexpr unsigned pokey_device::FREQ_17_EXACT;
@@ -566,23 +564,10 @@ void pokey_device::step_pot()
void pokey_device::step_one_clock(void)
{
- int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
-
+ /* Clocks only count if we are not in a reset */
if (m_SKCTL & SK_RESET)
{
- /* Clocks only count if we are not in a reset */
- int clock_triggered[3] = {0,0,0};
- int clk;
- for (clk = 0; clk < 3; clk++)
- {
- m_clock_cnt[clk]++;
- if (m_clock_cnt[clk] >= clock_divisors[clk])
- {
- m_clock_cnt[clk] = 0;
- clock_triggered[clk] = 1;
- }
- }
-
+ /* polynom pointers */
if (++m_p4 >= 0x0000f)
m_p4 = 0;
if (++m_p5 >= 0x0001f)
@@ -592,7 +577,23 @@ void pokey_device::step_one_clock(void)
if (++m_p17 >= 0x1ffff)
m_p17 = 0;
- clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
+ /* CLK_1: no presacler */
+ int clock_triggered[3] = {1,0,0};
+ /* CLK_28: prescaler 63.9211 kHz */
+ if (++m_clock_cnt[CLK_28] >= DIV_64)
+ {
+ m_clock_cnt[CLK_28] = 0;
+ clock_triggered[CLK_28] = 1;
+ }
+ /* CLK_114 prescaler 15.6999 kHz */
+ if (++m_clock_cnt[CLK_114] >= DIV_15)
+ {
+ m_clock_cnt[CLK_114] = 0;
+ clock_triggered[CLK_114] = 1;
+ }
+
+ int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
+ int clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
if (clock_triggered[clk])
m_channel[CHAN1].inc_chan();
--
2.20.1

View File

@@ -1,123 +0,0 @@
From 611f9b13acd4c08aa8d36054c5eccdbec237c673 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Sat, 2 Mar 2019 23:13:27 +0100
Subject: [PATCH] OSD/OpenGl: Improve performance by moving calculations out of
loop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This one was triggered by batman.
Test case:
mame64 -nothrottle batman
Before: Average speed: 312.11% (20 seconds)
After: Average speed: 327.43% (19 seconds)
Upstream-Status: Submitted [1]
[1] https://github.com/mamedev/mame/pull/4717
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/osd/modules/render/drawogl.cpp | 32 +++++++++++++++++-------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp
index 98db62fdf1..95345878cf 100644
--- a/src/osd/modules/render/drawogl.cpp
+++ b/src/osd/modules/render/drawogl.cpp
@@ -2056,8 +2056,9 @@ static inline void copyline_palette16(uint32_t *dst, const uint16_t *src, int wi
for (x = 0; x < width; x++)
{
int srcpix = *src++;
+ uint32_t dstval = 0xff000000 | palette[srcpix];
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = 0xff000000 | palette[srcpix];
+ *dst++ = dstval;
}
if (xborderpix)
*dst++ = 0xff000000 | palette[*--src];
@@ -2079,8 +2080,9 @@ static inline void copyline_palettea16(uint32_t *dst, const uint16_t *src, int w
for (x = 0; x < width; x++)
{
int srcpix = *src++;
+ uint32_t dstval = palette[srcpix];
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = palette[srcpix];
+ *dst++ = dstval;
}
if (xborderpix)
*dst++ = palette[*--src];
@@ -2109,10 +2111,9 @@ static inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width,
for (x = 0; x < width; x++)
{
rgb_t srcpix = *src++;
+ uint32_t dstval = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
for (int x2 = 0; x2 < xprescale; x2++)
- {
- *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
- }
+ *dst++ = dstval;
}
if (xborderpix)
{
@@ -2129,11 +2130,9 @@ static inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width,
for (x = 0; x < width; x++)
{
rgb_t srcpix = *src++;
-
+ uint32_t dstval = 0xff000000 | srcpix;
for (int x2 = 0; x2 < xprescale; x2++)
- {
- *dst++ = 0xff000000 | srcpix;
- }
+ *dst++ = dstval;
}
if (xborderpix)
*dst++ = 0xff000000 | *--src;
@@ -2161,8 +2160,9 @@ static inline void copyline_argb32(uint32_t *dst, const uint32_t *src, int width
for (x = 0; x < width; x++)
{
rgb_t srcpix = *src++;
+ uint32_t dstval = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
+ *dst++ = dstval;
}
if (xborderpix)
{
@@ -2257,10 +2257,12 @@ static inline void copyline_yuy16_to_argb(uint32_t *dst, const uint16_t *src, in
uint16_t srcpix1 = *src++;
uint8_t cb = srcpix0 & 0xff;
uint8_t cr = srcpix1 & 0xff;
+ uint32_t dstval0 = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
+ uint32_t dstval1 = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
+ *dst++ = dstval0;
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
+ *dst++ = dstval1;
}
if (xborderpix)
{
@@ -2291,10 +2293,12 @@ static inline void copyline_yuy16_to_argb(uint32_t *dst, const uint16_t *src, in
uint16_t srcpix1 = *src++;
uint8_t cb = srcpix0 & 0xff;
uint8_t cr = srcpix1 & 0xff;
+ uint32_t dstval0 = ycc_to_rgb(srcpix0 >> 8, cb, cr);
+ uint32_t dstval1 = ycc_to_rgb(srcpix1 >> 8, cb, cr);
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
+ *dst++ = dstval0;
for (int x2 = 0; x2 < xprescale; x2++)
- *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
+ *dst++ = dstval1;
}
if (xborderpix)
{
--
2.20.1

View File

@@ -1,61 +0,0 @@
From c40e6aedf69c57269fd63c145436239eee185bcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Tue, 5 Mar 2019 21:08:38 +0100
Subject: [PATCH 1/2] pokey_device::step_pot: remove operations with no effect
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* step_pot is called once only. There is ensured already that pokey is in
reset state.
* in case there were no bits latched to one, there is no need to call
synchronize(SYNC_POT, 0) because m_ALLPOT won't change.
Performance results with missile / starwars:
Before:
./mame64 -bench 50 missile -> Average speed: 1171.67% (49 seconds)
./mame64 -bench 50 starwars -> Average speed: 551.66% (49 seconds)
After:
./mame64 -bench 50 missile -> Average speed: 1321.16% (49 seconds)
./mame64 -bench 50 starwars -> Average speed: 551.10% (49 seconds)
Upstream-Status: Applied [1]
[1] https://github.com/mamedev/mame/pull/4729
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 231dc01e8b..5aa797bb54 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -538,11 +538,8 @@ void pokey_device::step_keyboard()
void pokey_device::step_pot()
{
- if ((m_SKCTL & SK_RESET) == 0)
- return;
-
- uint8_t upd = 0;
m_pot_counter++;
+ uint8_t upd = 0;
for (int pot = 0; pot < 8; pot++)
{
if ((m_POTx[pot]<m_pot_counter) || (m_pot_counter == 228))
@@ -551,7 +548,9 @@ void pokey_device::step_pot()
/* latching is emulated in read */
}
}
- synchronize(SYNC_POT, upd);
+ // some pots latched?
+ if (upd != 0)
+ synchronize(SYNC_POT, upd);
}
/*
--
2.20.1

View File

@@ -1,36 +0,0 @@
From 35d0c1b43eeff5a8e7a0e24b9dec8f170957ee0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Thu, 7 Mar 2019 20:11:01 +0100
Subject: [PATCH 1/3] pokey: force recalculation of raw sound output after
reset
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* This fixes a regression introduced by [1]
* Could not detect and performance change introduced by this
Upstream-Status: Applied
[1] https://github.com/mamedev/mame/pull/4702/commits/308c3c2d04ce8f3af09f620f524579145cbbcaf0
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 5aa797bb54..a79c8abb71 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -1031,6 +1031,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
m_clock_cnt[0] = 0;
m_clock_cnt[1] = 0;
m_clock_cnt[2] = 0;
+ m_old_raw_inval = true;
/* FIXME: Serial port reset ! */
}
break;
--
2.20.1

View File

@@ -1,48 +0,0 @@
From fa6f8255b46ad594d7fbf949a64397b4aa8231ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Fri, 8 Mar 2019 01:05:24 +0100
Subject: [PATCH 1/2] pokey: remove unused macros
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream-Status: Submitted [1]
[1] https://github.com/mamedev/mame/pull/4735
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/devices/sound/pokey.cpp | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index a79c8abb71..3372ac70a8 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -99,11 +99,6 @@
#define TIMER2 1
#define TIMER4 2
-/* values to add to the divisors for the different modes */
-#define DIVADD_LOCLK 1
-#define DIVADD_HICLK 4
-#define DIVADD_HICLK_JOINED 7
-
/* AUDCx */
#define NOTPOLY5 0x80 /* selects POLY5 or direct CLOCK */
#define POLY4 0x40 /* selects POLY4 or POLY17 */
@@ -152,11 +147,6 @@
#define DIV_64 28 /* divisor for 1.78979 MHz clock to 63.9211 kHz */
#define DIV_15 114 /* divisor for 1.78979 MHz clock to 15.6999 kHz */
-#define P4(chip) chip->poly4[chip->p4]
-#define P5(chip) chip->poly5[chip->p5]
-#define P9(chip) chip->poly9[chip->p9]
-#define P17(chip) chip->poly17[chip->p17]
-
#define CLK_1 0
#define CLK_28 1
#define CLK_114 2
--
2.20.1

View File

@@ -6,19 +6,11 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=798620970c471a3a6b7b5e9c9192fe12"
SRC_URI = " \
https://github.com/mamedev/mame/archive/${BPN}${PV}.tar.gz \
file://0001-pokey-performance-optimization-by-not-using-modulus.patch \
file://0002-pokey-rename-pokey_device-m_output-pokey_device-m_ou.patch \
file://0003-pokey-rework-for-performance-enhancements.patch \
file://0004-pokey-rework-prescaler-handling.patch \
file://0005-OSD-OpenGl-Improve-performance-by-moving-calculation.patch \
file://0006-pokey_device-step_pot-remove-operations-with-no-effe.patch \
file://0007-pokey-force-recalculation-of-raw-sound-output-after-.patch \
file://0008-pokey-remove-unused-macros.patch \
file://no-upstream/0001-pokey-Make-step_one_clock-inline.patch \
file://mame.desktop \
"
SRC_URI[md5sum] = "7a368efb80c228258d1928ed74bbc7a4"
SRC_URI[sha256sum] = "69c29533d2128345c59fbf23fabc3af696322a77a6c1d7a7bd7f5a2ee57adafb"
SRC_URI[md5sum] = "c674867e5477f883678752566fe92af7"
SRC_URI[sha256sum] = "d02dba8e144ac11878226ef48aa8e4d30a33d77dd72210f84e9803908c70e8b2"
S = "${WORKDIR}/${BPN}-${BPN}${PV}"