|
From: <mla...@us...> - 2008-01-24 07:12:27
|
Revision: 449
http://g15daemon.svn.sourceforge.net/g15daemon/?rev=449&view=rev
Author: mlampard
Date: 2008-01-23 23:12:07 -0800 (Wed, 23 Jan 2008)
Log Message:
-----------
g15daemon 1.9x: work around bug exposed by g15composer - occasionally screens were not being updated.
Modified Paths:
--------------
trunk/g15daemon-wip/ChangeLog
trunk/g15daemon-wip/g15daemon/main.c
trunk/g15daemon-wip/g15daemon/utility_funcs.c
Modified: trunk/g15daemon-wip/ChangeLog
===================================================================
--- trunk/g15daemon-wip/ChangeLog 2008-01-24 04:01:44 UTC (rev 448)
+++ trunk/g15daemon-wip/ChangeLog 2008-01-24 07:12:07 UTC (rev 449)
@@ -160,3 +160,6 @@
/tmp/g15daemon-sc-?.pbm, where ? is an incremental number.
- BugFix: Only wakeup display thread if LCD buffer is visible.
- Packaging: Fix debian packaging to include plugins.
+SVN: (1.9.6)
+- BugFix: If lcd refresh is requested whilst processing, refreshes were missed.
+- Optimisation: The delay between screen updates is no longer required. remove.
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2008-01-24 04:01:44 UTC (rev 448)
+++ trunk/g15daemon-wip/g15daemon/main.c 2008-01-24 07:12:07 UTC (rev 449)
@@ -223,10 +223,8 @@
static void *lcd_draw_thread(void *lcdlist){
g15daemon_t *masterlist = (g15daemon_t*)(lcdlist);
- static unsigned int lastscreentime;
/* unsigned int fps = 0; */
lcd_t *displaying = masterlist->tail->lcd;
- char *lastdisplayed=NULL;
memset(displaying->buf,0,1024);
g15daemon_sleep(2);
@@ -244,13 +242,9 @@
/* if the current screen is less than 20ms from the previous (equivelant to 50fps) delay it */
/* this allows a real-world fps of 40fps with no almost frame loss and reduces peak usb bus-load */
- if((g15daemon_gettime_ms() - lastscreentime)>=20||(char*)displaying!=lastdisplayed){
- g15daemon_log(LOG_DEBUG,"Updating LCD");
- uf_write_buf_to_g15(displaying);
- lastscreentime = g15daemon_gettime_ms();
- lastdisplayed = (char*)displaying;
- g15daemon_log(LOG_DEBUG,"LCD Update Complete");
- }
+ g15daemon_log(LOG_DEBUG,"Updating LCD");
+ uf_write_buf_to_g15(displaying);
+ g15daemon_log(LOG_DEBUG,"LCD Update Complete");
if(displaying->state_changed){
pthread_mutex_lock(&g15lib_mutex);
Modified: trunk/g15daemon-wip/g15daemon/utility_funcs.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/utility_funcs.c 2008-01-24 04:01:44 UTC (rev 448)
+++ trunk/g15daemon-wip/g15daemon/utility_funcs.c 2008-01-24 07:12:07 UTC (rev 449)
@@ -75,34 +75,39 @@
return ptr;
}
-
+static int refresh_pending=0;
void g15daemon_init_refresh() {
pthread_condattr_t attr;
pthread_cond_init(&lcd_refresh, &attr);
}
void g15daemon_send_refresh(lcd_t *lcd) {
- if(lcd==lcd->masterlist->current->lcd||lcd->state_changed)
+ if(lcd==lcd->masterlist->current->lcd||lcd->state_changed) {
pthread_cond_broadcast(&lcd_refresh);
+ refresh_pending++;
+ }
}
void g15daemon_wait_refresh() {
pthread_mutex_t dummy_mutex;
struct timespec timeout;
int retval;
- /* Create a dummy mutex which doesn't unlock for sure while waiting. */
- pthread_mutex_init(&dummy_mutex, NULL);
- pthread_mutex_lock(&dummy_mutex);
+ if(refresh_pending<1) {
+ /* Create a dummy mutex which doesn't unlock for sure while waiting. */
+ pthread_mutex_init(&dummy_mutex, NULL);
+ pthread_mutex_lock(&dummy_mutex);
start:
- time(&timeout.tv_sec);
- timeout.tv_sec += 1;
- timeout.tv_nsec = 0L;
+ time(&timeout.tv_sec);
+ timeout.tv_sec += 1;
+ timeout.tv_nsec = 0L;
- retval=pthread_cond_timedwait(&lcd_refresh, &dummy_mutex, &timeout);
- if(!leaving && retval == ETIMEDOUT)
- goto start;
- pthread_mutex_unlock(&dummy_mutex);
- pthread_mutex_destroy(&dummy_mutex);
+ retval=pthread_cond_timedwait(&lcd_refresh, &dummy_mutex, &timeout);
+ if(!leaving && retval == ETIMEDOUT)
+ goto start;
+ pthread_mutex_unlock(&dummy_mutex);
+ pthread_mutex_destroy(&dummy_mutex);
+ }
+ refresh_pending--;
}
void g15daemon_quit_refresh() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|