diff --git a/src/driver/abstime.c b/src/driver/abstime.c index af7c1c7fc..a242b7877 100644 --- a/src/driver/abstime.c +++ b/src/driver/abstime.c @@ -2,16 +2,16 @@ #include /* for perror */ #include -time_t time_monotonic_ms(void) +int64_t time_monotonic_ms(void) { struct timespec t; - time_t ret; + int64_t ret; if (clock_gettime(CLOCK_MONOTONIC, &t)) { perror("time_monotonic_ms clock_gettime"); return -1; } - ret = ((t.tv_sec + 604800)& 0x01FFFFF) * 1000; /* avoid overflow */ + ret = (t.tv_sec + 604800) * (int64_t)1000; /* avoid overflow */ ret += t.tv_nsec / 1000000; return ret; } diff --git a/src/driver/abstime.h b/src/driver/abstime.h index b530755b6..78d1e6117 100644 --- a/src/driver/abstime.h +++ b/src/driver/abstime.h @@ -6,8 +6,8 @@ extern "C" { #endif -extern time_t time_monotonic_ms(void); -extern time_t time_monotonic(void); +time_t time_monotonic(void); +int64_t time_monotonic_ms(void); uint64_t time_monotonic_us(void); #ifdef __cplusplus } diff --git a/src/driver/fb_accel_glfb.cpp b/src/driver/fb_accel_glfb.cpp index d19397530..0e4c1c859 100644 --- a/src/driver/fb_accel_glfb.cpp +++ b/src/driver/fb_accel_glfb.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include extern GLFramebuffer *glfb; @@ -115,18 +116,18 @@ void CFbAccelGLFB::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32 void CFbAccelGLFB::run() { printf(LOGTAG "run start\n"); - time_t last_blit = 0; + int64_t last_blit = 0; blit_pending = false; blit_thread = true; blit_mutex.lock(); set_threadname("glfb::autoblit"); while (blit_thread) { blit_cond.wait(&blit_mutex, blit_pending ? BLIT_INTERVAL_MIN : BLIT_INTERVAL_MAX); - time_t now = time_monotonic_ms(); + int64_t now = time_monotonic_ms(); if (now - last_blit < BLIT_INTERVAL_MIN) { blit_pending = true; - //printf(LOGTAG "run: skipped, time %ld\n", now - last_blit); + //printf(LOGTAG "run: skipped, time %" PRId64 "\n", now - last_blit); } else { diff --git a/src/driver/fb_accel_sti.cpp b/src/driver/fb_accel_sti.cpp index f04161d84..ff67528ab 100644 --- a/src/driver/fb_accel_sti.cpp +++ b/src/driver/fb_accel_sti.cpp @@ -37,14 +37,12 @@ #include #include #include +#include #include #include -#include -#include - #include #include @@ -62,56 +60,6 @@ static size_t lbb_sz = 1920 * 1080; /* offset from fb start in 'pixels' */ static size_t lbb_off = lbb_sz * sizeof(fb_pixel_t); /* same in bytes */ static int backbuf_sz = 0; -static char lockfunc[256]; -static pthread_mutex_t mymutex = PTHREAD_MUTEX_INITIALIZER; - -#if 1 -#define mutex __invalid_mutex__ -#define LOCK_WAIT_MS 5 -#define NS_IN_SEC 1000000000LL -#define NS_IN_MS 1000000 -#define TRYLOCK_RET(m) \ - do { \ - struct timespec wait; \ - clock_gettime(CLOCK_REALTIME, &wait); \ - wait.tv_nsec += (LOCK_WAIT_MS * NS_IN_MS); \ - wait.tv_sec += wait.tv_nsec % NS_IN_SEC; \ - wait.tv_nsec %= NS_IN_SEC; \ - int status = pthread_mutex_timedlock(&mymutex, &wait); \ - if (status) { \ - printf(LOGTAG "::%s timedlock failed: %d (%s) locked: '%s'\n", __func__, \ - status, strerror(status), lockfunc); \ - return; \ - } \ - strcpy(lockfunc, __func__); \ - } while(0) - -#define UNLOCK(m) pthread_mutex_unlock(&mymutex) - -#else -#define TRYLOCK_RET(m) \ - do { \ - time_t _start = time_monotonic_ms(); \ - time_t _now = _start; \ - while (true) { \ - int status = m.trylock(); \ - if (status == 0) \ - break; \ - _now = time_monotonic_ms(); \ - usleep(1000); \ - if (_now - _start < LOCK_WAIT_MS) \ - continue; \ - printf(LOGTAG "::%s trylock failed after %dms: %d (%s) locked '%s'\n", __func__, \ - LOCK_WAIT_MS, status, (status > 0) ? strerror(status) : strerror(errno), \ - lockfunc); \ - return; \ - } \ - strcpy(lockfunc, __func__); \ - } while(0) - -#define UNLOCK(m) m.unlock() -#endif - void CFbAccelSTi::waitForIdle(const char *) { #if 0 /* blits too often and does not seem to be necessary */ @@ -124,10 +72,8 @@ void CFbAccelSTi::waitForIdle(const char *) } blit_mutex.unlock(); #endif -// OpenThreads::ScopedLock m_lock(mutex); - TRYLOCK_RET(mutex); + OpenThreads::ScopedLock m_lock(mutex); ioctl(fd, STMFBIO_SYNC_BLITTER); - UNLOCK(mutex); } CFbAccelSTi::CFbAccelSTi() @@ -326,12 +272,10 @@ void CFbAccelSTi::paintRect(const int x, const int y, const int dx, const int dy bltData.colour = col; mark(xx, yy, bltData.dst_right, bltData.dst_bottom); -// OpenThreads::ScopedLock m_lock(mutex); - TRYLOCK_RET(mutex); + OpenThreads::ScopedLock m_lock(mutex); if (ioctl(fd, STMFBIO_BLT, &bltData ) < 0) fprintf(stderr, "blitRect FBIO_BLIT: %m x:%d y:%d w:%d h:%d s:%d\n", xx,yy,width,height,stride); blit(); - UNLOCK(mutex); } void CFbAccelSTi::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) @@ -371,8 +315,7 @@ void CFbAccelSTi::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_ blt_data.dstMemSize = stride * yRes + lbb_off; mark(x, y, blt_data.dst_right, blt_data.dst_bottom); -// OpenThreads::ScopedLock m_lock(mutex); - TRYLOCK_RET(mutex); + OpenThreads::ScopedLock m_lock(mutex); ioctl(fd, STMFBIO_SYNC_BLITTER); if (fbbuff != backbuffer) memmove(backbuffer, fbbuff, mem_sz); @@ -381,7 +324,7 @@ void CFbAccelSTi::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_ if (ioctl(fd, STMFBIO_BLT_EXTERN, &blt_data) < 0) perror(LOGTAG "blit2FB STMFBIO_BLT_EXTERN"); - UNLOCK(mutex); + return; } #define BLIT_INTERVAL_MIN 40 @@ -389,7 +332,7 @@ void CFbAccelSTi::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_ void CFbAccelSTi::run() { printf(LOGTAG "::run start\n"); - time_t last_blit = 0; + int64_t last_blit = 0; blit_pending = false; blit_thread = true; set_threadname("stifb::autoblit"); @@ -398,11 +341,12 @@ void CFbAccelSTi::run() blit_cond.wait(&blit_mutex, blit_pending ? BLIT_INTERVAL_MIN : BLIT_INTERVAL_MAX); blit_mutex.unlock(); - time_t now = time_monotonic_ms(); - if (now - last_blit < BLIT_INTERVAL_MIN) + int64_t now = time_monotonic_ms(); + int64_t diff = now - last_blit; + if (diff < BLIT_INTERVAL_MIN) { blit_pending = true; - //printf(LOGTAG "::run: skipped, time %ld\n", now - last_blit); + //printf(LOGTAG "::run: skipped, time %" PRId64 "\n", diff); } else { @@ -430,18 +374,15 @@ void CFbAccelSTi::blit() void CFbAccelSTi::_blit() { #if 0 - static time_t last = 0; - time_t now = time_monotonic_ms(); - printf("%s %ld\n", __func__, now - last); + static int64_t last = 0; + int64_t now = time_monotonic_ms(); + printf("%s %" PRId64 "\n", __func__, now - last); last = now; #endif -// OpenThreads::ScopedLock m_lock(mutex); - TRYLOCK_RET(mutex); + OpenThreads::ScopedLock m_lock(mutex); #ifdef PARTIAL_BLIT - if (to_blit.xs == INT_MAX) { - UNLOCK(mutex); + if (to_blit.xs == INT_MAX) return; - } int srcXa = to_blit.xs; int srcYa = to_blit.ys; @@ -528,15 +469,13 @@ void CFbAccelSTi::_blit() to_blit.xs = to_blit.ys = INT_MAX; to_blit.xe = to_blit.ye = 0; #endif - UNLOCK(mutex); } /* not really used yet */ #ifdef PARTIAL_BLIT void CFbAccelSTi::mark(int xs, int ys, int xe, int ye) { -// OpenThreads::ScopedLock m_lock(mutex); - TRYLOCK_RET(mutex); + OpenThreads::ScopedLock m_lock(mutex); if (xs < to_blit.xs) to_blit.xs = xs; if (ys < to_blit.ys) @@ -565,7 +504,6 @@ void CFbAccelSTi::mark(int xs, int ys, int xe, int ye) *kill = 1; /* oh my */ } #endif - UNLOCK(mutex); } #else void CFbAccelSTi::mark(int, int, int, int) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 164ec9dcb..2b867cc5d 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -154,7 +154,7 @@ CSdtThread threadSDT; #endif #ifdef DEBUG_EVENT_LOCK -static time_t lockstart = 0; +static int64_t lockstart = 0; #endif static int sectionsd_stop = 0; @@ -209,9 +209,9 @@ inline void unlockEvents(void) { #ifdef DEBUG_EVENT_LOCK if (lockstart) { - time_t tmp = time_monotonic_ms() - lockstart; + int64_t tmp = time_monotonic_ms() - lockstart; if (tmp > 50) - xprintf("locked ms %d\n", tmp); + xprintf("locked ms %" PRId64 "\n", tmp); lockstart = 0; } #endif @@ -1488,12 +1488,12 @@ void CTimeThread::run() * shutdown" hack on with libcoolstream... :-( */ rc = dmx->Read(static_buf, MAX_SECTION_LENGTH, timeoutInMSeconds); #else - time_t start = time_monotonic_ms(); + int64_t start = time_monotonic_ms(); /* speed up shutdown by looping around Read() */ do { rc = dmx->Read(static_buf, MAX_SECTION_LENGTH, timeoutInMSeconds / 12); } while (running && rc == 0 - && (time_monotonic_ms() - start) < (time_t)timeoutInMSeconds); + && (time_monotonic_ms() - start) < (int64_t)timeoutInMSeconds); #endif xprintf("%s: get DVB time ch 0x%012" PRIx64 " rc: %d neutrino_sets_time %d\n", name.c_str(), current_service, rc, messaging_neutrino_sets_time); diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index adfcebb08..c855207da 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -486,12 +486,12 @@ void *insertEventsfromFile(void * data) std::string epg_dir = (char *) data; indexname = epg_dir + "index.xml"; - time_t now = time_monotonic_ms(); + int64_t now = time_monotonic_ms(); xmlDocPtr index_parser = parseXmlFile(indexname.c_str()); if (index_parser == NULL) { readEventsFromDir(epg_dir, ev_count); - printf("[sectionsd] Reading Information finished after %ld milliseconds (%d events)\n", + printf("[sectionsd] Reading Information finished after %" PRId64 " milliseconds (%d events)\n", time_monotonic_ms()-now, ev_count); reader_ready = true; pthread_exit(NULL); @@ -515,7 +515,7 @@ void *insertEventsfromFile(void * data) xmlFreeDoc(index_parser); printdate_ms(stdout); - printf("[sectionsd] Reading Information finished after %ld milliseconds (%d events)\n", + printf("[sectionsd] Reading Information finished after %" PRId64 " milliseconds (%d events)\n", time_monotonic_ms()-now, ev_count); reader_ready = true; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 07915b910..7582562e6 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1318,7 +1318,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start } break; } - case CRCInput::RC_help: + case CRCInput::RC_info: bigFonts = bigFonts ? false : true; ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 1ea66d086..092afe35e 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2918,6 +2918,8 @@ void CMoviePlayerGui::makeScreenShot(bool autoshot, bool } } sc->Start(); +#else + (void)forcover; #endif if (autoshot) autoshot_done = true; diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 098d723bd..e3a0da3e1 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -142,7 +142,7 @@ class CMoviePlayerGui : public CMenuTarget unsigned short sub_supported[MAX_PLAYBACK_PIDS]; int currentspid; int min_x, min_y, max_x, max_y; - time_t end_time; + int64_t end_time; bool ext_subs; bool lock_subs; uint64_t last_read; diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 179fb36f3..0a0216880 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -1075,7 +1075,7 @@ int CStreamInfo2::update_rate () usleep(timeout * 1000); b_len = mp->GetReadCount(); } else { - time_t start = time_monotonic_ms(); + int64_t start = time_monotonic_ms(); /* always sample for ~100ms */ while (time_monotonic_ms() - start < timeout) { @@ -1083,7 +1083,7 @@ int CStreamInfo2::update_rate () if (ret >= 0) b_len += ret; } - //printf("ts: read %d time %d\n", b_len, time_monotonic_ms() - start); + //printf("ts: read %d time %" PRId64 "\n", b_len, time_monotonic_ms() - start); } //printf("ts: read %d\n", b_len); diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 0c7ffdb22..86a2e30d7 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -366,14 +366,14 @@ int CVideoSettings::showVideoSetup() CMenuOptionChooser * vs_videomodes_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOMODE, &g_settings.video_Mode, vmode_options, vmode_option_count, true, this, CRCInput::RC_nokey, "", true); vs_videomodes_ch->setHint("", LOCALE_MENU_HINT_VIDEO_MODE); - CMenuOptionChooser *vs_dbdropt_ch = NULL; + CMenuOptionChooser * vs_dbdropt_ch = NULL; + CMenuForwarder * vs_videomodes_fw = NULL; CMenuWidget videomodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); #ifdef BOXMODEL_CS_HD2 CMenuForwarder * vs_automodes_fw = NULL; CMenuWidget automodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); #endif CAutoModeNotifier anotify; - CMenuForwarder *vs_videomodes_fw = NULL; //dbdr options if (system_rev != 0x01) /* dbdr options only on COOLSTREAM */ { diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index bd5daa3ca..f2b641f5a 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -133,14 +133,14 @@ void CShellWindow::exec() fds.events = POLLIN | POLLHUP | POLLERR; fcntl(fds.fd, F_SETFL, fcntl(fds.fd, F_GETFL, 0) | O_NONBLOCK); - time_t lastPaint = time_monotonic_ms(); + int64_t lastPaint = time_monotonic_ms(); bool ok = true, nlseen = false, dirty = false, incomplete = false; char output[1024]; std::string txt = ""; std::string line = ""; do { - time_t now; + int64_t now; fds.revents = 0; int r = poll(&fds, 1, 300); if (r > 0) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 6251c58d2..6dfa4f444 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2246,10 +2246,10 @@ void CNeutrinoApp::InitSectiondClient() #if 0 /* TODO: check if still needed */ /* wait for sectionsd to be able to process our registration */ - time_t t = time_monotonic_ms(); + int64_t t = time_monotonic_ms(); while (! sectionsd_isReady()) sleep(0); - dprintf(DEBUG_NORMAL, "had to wait %ld ms for sectionsd to start up\n", time_monotonic_ms() - t); + dprintf(DEBUG_NORMAL, "had to wait %" PRId64 " ms for sectionsd to start up\n", time_monotonic_ms() - t); #endif g_Sectionsd = new CSectionsdClient; struct timespec t; @@ -2520,10 +2520,10 @@ TIMER_START(); InitSectiondClient(); /* wait until timerd is ready... */ - time_t timerd_wait = time_monotonic_ms(); + int64_t timerd_wait = time_monotonic_ms(); while (timerd_signal >= 0) usleep(100); - dprintf(DEBUG_NORMAL, "had to wait %ld ms for timerd start...\n", time_monotonic_ms() - timerd_wait); + dprintf(DEBUG_NORMAL, "had to wait %" PRId64 " ms for timerd start...\n", time_monotonic_ms() - timerd_wait); InitTimerdClient(); // volume diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index e26051ff9..125ab04e5 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -411,8 +411,10 @@ void CNeutrinoApp::InitMenuService() //bouquet edit // TODO: this needs a neutrino restart after changing parentallock_prompt to activate :-( + // TODO:2 check if this deviation from upstream is still needed CLockedMenuForwarder *lf; lf = new CLockedMenuForwarder(LOCALE_BOUQUETEDITOR_NAME, g_settings.parentallock_pincode, g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED, true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_blue); + // TODO:2 end /* does not work with CLockedMenuForwarder yet? lf->setHint(NEUTRINO_ICON_HINT_BEDIT, LOCALE_MENU_HINT_BEDIT); */ diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index bd18b5314..3123a60b1 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -131,15 +131,16 @@ static const struct dtv_property dvbt_cmdargs[] = { #define diff(x,y) (max(x,y) - min(x,y)) #define FE_TIMER_INIT() \ - unsigned int timer_start; \ - static unsigned int tmin = 2000, tmax = 0; \ - unsigned int timer_msec = 0; + int64_t timer_start; \ + static uint32_t tmin = 2000, tmax = 0; \ + uint32_t timer_msec = 0; #define FE_TIMER_START() \ timer_start = time_monotonic_ms(); #define FE_TIMER_STOP(label) \ - timer_msec = time_monotonic_ms() - timer_start; \ + timer_msec = (uint32_t)(time_monotonic_ms() - \ + timer_start); \ if(tmin > timer_msec) tmin = timer_msec; \ if(tmax < timer_msec) tmax = timer_msec; \ printf("[fe%d] %s: %u msec (min %u max %u)\n", \ @@ -706,7 +707,7 @@ struct dvb_frontend_event CFrontend::getEvent(void) if (pfd.revents & (POLLIN | POLLPRI)) { //FE_TIMER_STOP("poll has event after"); - timer_msec = time_monotonic_ms() - timer_start; /* FE_TIMER_STOP does this :( */ + timer_msec = (uint32_t)(time_monotonic_ms() - timer_start); /* FE_TIMER_STOP does this :( */ memset(&event, 0, sizeof(struct dvb_frontend_event)); ret = ioctl(fd, FE_GET_EVENT, &event);