VDR-1.3.24: OSD speedup

Message ID 4290DCD5.3080006@gmx.de
State New
Headers

Commit Message

Reinhard Nissl May 22, 2005, 7:26 p.m. UTC
  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.
  

Comments

Jan Rieger May 22, 2005, 8:06 p.m. UTC | #1
----- Original Message ----- 
From: "Reinhard Nissl" <rnissl@gmx.de>
To: "Klaus Schmidinger's VDR" <vdr@linuxtv.org>
Sent: Sunday, May 22, 2005 9:26 PM
Subject: [vdr] VDR-1.3.24: OSD speedup


> 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.

There are plugins that use the cStatus interface to show informations on 
external displays. And VDR can't know how many rows fits on these kinds of 
display. So I think it's not a good idea to reduce the entries to only that 
ones that fits on the VDR OSD!

Jan
  
C.Y.M May 22, 2005, 8:44 p.m. UTC | #2
Jan Rieger wrote:
> 
> ----- Original Message ----- From: "Reinhard Nissl" <rnissl@gmx.de>
> To: "Klaus Schmidinger's VDR" <vdr@linuxtv.org>
> Sent: Sunday, May 22, 2005 9:26 PM
> Subject: [vdr] VDR-1.3.24: OSD speedup
> 
> 
>> 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.
> 
> 
> There are plugins that use the cStatus interface to show informations on
> external displays. And VDR can't know how many rows fits on these kinds
> of display. So I think it's not a good idea to reduce the entries to
> only that ones that fits on the VDR OSD!

This patch also conflicts with the osdbase-maxitems.diff (used with the
text2skin plugin).

Best Regards,
C.Y.M.
  
Anssi Hannula May 23, 2005, 7:02 p.m. UTC | #3
C.Y.M wrote:
> 
> This patch also conflicts with the osdbase-maxitems.diff (used with the
> text2skin plugin).
> 

Hmm, what patch is that? Haven't heard of it.
  

Patch

--- ../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)