summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lua
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2020-06-22 11:05:17 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2020-06-23 11:17:17 +0000
commitdf1b3c1d2c868a1110cd18253eda4d972550c77a (patch)
treed7b44d083dc8315f8b8e66eea402b148316ed4de /apps/plugins/lua
parent59454f93b345dbf6a82297e80b6af9730d00fc8c (diff)
downloadrockbox-df1b3c1d2c868a1110cd18253eda4d972550c77a.tar.gz
rockbox-df1b3c1d2c868a1110cd18253eda4d972550c77a.tar.bz2
rockbox-df1b3c1d2c868a1110cd18253eda4d972550c77a.zip
lua RockEv timing fixes
just a few tweaks to the RockEv backend to allow tighter event timing originally there was a timeout where events would be consolidated prior to running the event thread, this slowed the faster events but it turns out this isn't really a big waster of time The callback from C => lua is a far bigger bottleneck Change-Id: Iffacbe49c4b83155099b1304590450f746576fa4
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r--apps/plugins/lua/rocklib_events.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/plugins/lua/rocklib_events.c b/apps/plugins/lua/rocklib_events.c
index 961fea030c..bf94cabe8a 100644
--- a/apps/plugins/lua/rocklib_events.c
+++ b/apps/plugins/lua/rocklib_events.c
@@ -139,7 +139,6 @@ struct event_data {
long *event_stack;
volatile long *get_tick;
struct thread_status status;
- char next_event;
/* callbacks */
struct cb_data *cb[EVENT_CT];
};
@@ -232,7 +231,7 @@ static void lua_interrupt_set(lua_State *L, int hookmask)
oldmask = lua_gethookmask(L);
oldcount = lua_gethookcount(L);
hook = lua_interrupt_callback;
- count = 1;
+ count = 10;
}
else
{
@@ -278,7 +277,7 @@ static void rev_timer_isr(void)
}
}
set_evt(ev_flag);
- if (--ev_data.next_event <= 0 && ev_data.status.event)
+ if (ev_data.status.event)
lua_interrupt_set(ev_data.L, ENABLE_LUA_HOOK);
}
@@ -342,7 +341,6 @@ skip_callback:
do
{
lua_interrupt_set(ev_data.L, DISABLE_LUA_HOOK);
- ev_data.next_event = EV_TICKS;
rb->yield();
} while (!has_thread_status(THREAD_QUIT) && (is_suspend(THREAD_EVENT_ALL)
|| !ev_data.status.event));
@@ -540,7 +538,6 @@ static void init_event_data(lua_State *L, struct event_data *ev_data)
ev_data->status.thread = 0;
/*ev_data->event_stack = NULL;*/
- ev_data->next_event = EV_TICKS;
/* callbacks */
for (unsigned int i= 0; i < EVENT_CT; i++)
ev_data->cb[i] = NULL;
@@ -587,7 +584,7 @@ static int rockev_register(lua_State *L)
event_ticks = luaL_optinteger(L, 3, EV_INPUT);
break;
case CUSTOMEVENT:
- event_ticks = luaL_optinteger(L, 3, EV_TIMER_TICKS);
+ event_ticks = luaL_optinteger(L, 3, EV_TICKS);
ev_flag = 0; /* don't remove suspend */
break;
case PLAYBKEVENT: /* see register_playbk_events() for flags */