mame: add more pokey performance
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
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: Submitted [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
|
||||
|
||||
@@ -17,6 +17,8 @@ After: Average speed: 319.34% (58 seconds)
|
||||
|
||||
I am aware that missile tests copyline_palette16() only.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
|
||||
---
|
||||
src/osd/modules/render/drawogl.cpp | 14 ++++++++------
|
||||
@@ -18,18 +18,18 @@ Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
|
||||
index 03ea12c7b5..80b9f64d6a 100644
|
||||
index 231dc01e8b..d20c20cc8a 100644
|
||||
--- a/src/devices/sound/pokey.cpp
|
||||
+++ b/src/devices/sound/pokey.cpp
|
||||
@@ -564,7 +564,7 @@ void pokey_device::step_pot()
|
||||
@@ -562,7 +562,7 @@ void pokey_device::step_pot()
|
||||
*
|
||||
*/
|
||||
|
||||
-void pokey_device::step_one_clock(void)
|
||||
+inline 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)
|
||||
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
|
||||
index 7e63e89e54..48858bc743 100644
|
||||
--- a/src/devices/sound/pokey.h
|
||||
|
||||
@@ -9,7 +9,8 @@ SRC_URI = " \
|
||||
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-OSD-OpenGl-Improve-performance-by-moving-calculation.patch \
|
||||
file://0004-pokey-rework-prescaler-handling.patch \
|
||||
file://0005-OSD-OpenGl-Improve-performance-by-moving-calculation.patch \
|
||||
file://no-upstream/0001-pokey-Make-step_one_clock-inline.patch \
|
||||
file://mame.desktop \
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user