From patchwork Sun May 22 19:26:13 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinhard Nissl X-Patchwork-Id: 11888 Received: from imap.gmx.net ([213.165.64.20] helo=mail.gmx.net) by www.linuxtv.org with smtp (Exim 4.34) id 1DZw61-0008R7-8g for vdr@linuxtv.org; Sun, 22 May 2005 21:26:45 +0200 Received: (qmail invoked by alias); 22 May 2005 19:26:14 -0000 Received: from Af3a0.a.pppool.de (EHLO [192.168.101.15]) [213.6.243.160] by mail.gmx.net (mp010) with SMTP; 22 May 2005 21:26:14 +0200 X-Authenticated: #527675 Message-ID: <4290DCD5.3080006@gmx.de> Date: Sun, 22 May 2005 21:26:13 +0200 From: Reinhard Nissl User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Klaus Schmidinger's VDR X-Y-GMX-Trusted: 0 Subject: [vdr] VDR-1.3.24: OSD speedup X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 May 2005 19:26:45 -0000 Status: O X-Status: X-Keywords: X-UID: 2419 Hi, the attached patch speeds up OSD display a little bit. I think it's wrong to tell cStatus that for example 2700 channel entries will be displayed when actually only 16 entries fit on screen. The other sections speed up paging beyond the first respectively last item (similarly to single line scrolling). Further ideas to reduce CPU load while scrolling: - Flush OSD after each scroll: will slow down scrolling and therefore most likely reduce CPU load. - Snoop ahead remote commands and do N scrolls at once, skipping N-1 paint operations. - Paint line by line and abort as soon as further remote commands arrive, to start over again. Bye. --- ../vdr-1.3.24-orig/osdbase.c 2005-01-07 17:16:41.000000000 +0100 +++ osdbase.c 2005-05-22 21:00:58.112297985 +0200 @@ -191,8 +191,11 @@ void cOsdMenu::Display(void) int count = Count(); if (count > 0) { int ni = 0; - for (cOsdItem *item = First(); item; item = Next(item)) + for (cOsdItem *item = Get(first); item; item = Next(item)) { cStatus::MsgOsdItem(item->Text(), ni++); + if (ni == displayMenuItems) + break; + } if (current < 0) current = 0; // just for safety - there HAS to be a current item! if (current - first >= displayMenuItems || current < first) { @@ -306,33 +309,38 @@ void cOsdMenu::CursorDown(void) void cOsdMenu::PageUp(void) { - current -= displayMenuItems; - first -= displayMenuItems; - if (first < 0) - first = current = 0; - if (!SelectableItem(current)) { - current -= (current > 0) ? 1 : -1; - first = min(first, current - 1); + if (current > 0) { + current -= displayMenuItems; + first -= displayMenuItems; + if (first < 0) + first = current = 0; + if (!SelectableItem(current)) { + current -= (current > 0) ? 1 : -1; + first = min(first, current - 1); + } + Display(); + DisplayCurrent(true); } - Display(); - DisplayCurrent(true); } void cOsdMenu::PageDown(void) { - current += displayMenuItems; - first += displayMenuItems; - int count = Count(); - if (current > count - 1) { - current = count - 1; - first = max(0, count - displayMenuItems); - } - if (!SelectableItem(current)) { - current += (current < count - 1) ? 1 : -1; - first = max(first, current - displayMenuItems); + int last = Count() - 1; + + if (current < last) { + current += displayMenuItems; + first += displayMenuItems; + if (current > last) { + current = last; + first = max(0, last + 1 - displayMenuItems); + } + if (!SelectableItem(current)) { + current += (current < last) ? 1 : -1; + first = max(first, current - displayMenuItems); + } + Display(); + DisplayCurrent(true); } - Display(); - DisplayCurrent(true); } void cOsdMenu::Mark(void)