LinuxTV Patchwork Valgrind warnings with LCARS OSD

login
register
mail settings
Submitter Marko Mäkelä
Date Nov. 15, 2013, 3:08 p.m.
Message ID <20131115150838.GB4009@x220>
Download mbox | patch
Permalink /patch/20736/
State New
Headers show

Comments

Marko Mäkelä - Nov. 15, 2013, 3:08 p.m.
Hi all,

I played a little with Valgrind:

valgrind --vgdb=yes --vgdb-error=0 ./vdr ...
and in gdb,
(gdb) target remote |vgdb

This seems to give me a false alarm for cRecording::cRecording():

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0811951a in cRecording::cRecording (this=0xbee4d958, FileName=0x0)
     at recording.c:801
801	  if (*(fileName + strlen(fileName) - 1) == '/')

The machine code is doing some magic after the strdup() on the previous 
line. I suspect that it is gcc that is performing strlen() with some 
black magic that trips this warning:

==3212== Invalid read of size 4
==3212==    at 0x811951A: cRecording::cRecording(char const*) (recording.c:801)
==3212==    by 0x80CEF77: cDvbPlayer::cDvbPlayer(char const*, bool) (dvbplayer.c:268)
==3212==  Address 0x4454004 is 76 bytes inside a block of size 78 alloc'd
==3212==    at 0x4028308: malloc (vg_replace_malloc.c:263)
==3212==    by 0x4315E1F: strdup (strdup.c:43)
==3212==    by 0x81194FE: cRecording::cRecording(char const*) (recording.c:800)

Then I got and fixed many warnings in Softdevice, which forgot to 
initialize some class members in constructors. Finally, I got a real 
warning for VDR:

==3212== Conditional jump or move depends on uninitialised value(s)
==3212==    at 0x4029654: __GI_strcmp (mc_replace_strmem.c:712)
==3212==    by 0x813ACD8: cSkinLCARSDisplayReplay::DrawTrack() (skinlcars.c:1786)
==3212==    by 0x813AE9F: cSkinLCARSDisplayReplay::Flush() (skinlcars.c:1861)
==3212==    by 0x80FCA55: cReplayControl::ShowProgress(bool) (menu.c:4670)
==3212==    by 0x80FCBF7: cReplayControl::ShowTimed(int) (menu.c:4583)
==3212==    by 0x80FCDEF: cReplayControl::cReplayControl(bool) (menu.c:4510)
==3212==    by 0x80AC745: main (vdr.c:1307)

"(gdb) monitor get_vbits" tells me that all of lastTrackId is 
uninitialized:

(gdb) up
#1  0x0813acd9 in cSkinLCARSDisplayReplay::DrawTrack (
     this=this@entry=0x457c3a0) at skinlcars.c:1786
1786	  if (!Track && *lastTrackId.description || Track && 
strcmp(lastTrackId.description, Track->description)) {
(gdb) p lastTrackId
$27 = {id = 0, language = "\000\000\000\000\000\000\000", description = 
'\000' <repeats 31 times>}
(gdb) p &lastTrackId
$28 = (tTrackId *) 0x457c434
(gdb) p sizeof lastTrackId
$29 = 42
(gdb) monitor get_vbits 0x457c434 42
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
ffffffff ffffffff ffff

BTW, !Track && x || Track && y
should IMO be simpler written Track ? y : x.

It looks like a memset() is missing from the cSkinLCARSDisplayReplay 
constructor. cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel() is 
doing the right thing:

   memset(&lastTrackId, 0, sizeof(lastTrackId));

Adding the memset() made this message go away. (Patch attached.)

The next problem is this one, which I get every time by pressing Play, 
Pause, Menu, Recordings after startup:

==3601== Conditional jump or move depends on uninitialised value(s)
==3601==    at 0x810C0DB: cRect::Intersected(cRect const&) const (osd.h:411)
==3601==    by 0x810E3D1: cPixmapMemory::DrawRectangle(cRect const&, 
unsigned int) (osd.c:1333)
==3601==    by 0x810AA0B: cOsd::DrawRectangle(int, int, int, int, 
unsigned int) (osd.c:1922)
==3601==    by 0x8130482: cSkinLCARSDisplayMenu::Clear() (skinlcars.c:1463)
==3601==    by 0x810651F: cOsdMenu::Display() (osdbase.c:223)
==3601==    by 0x80FA3D1: cMenuMain::Set() (menu.c:3432)
==3601==    by 0x80FA9FD: cMenuMain::cMenuMain(eOSState, bool) (menu.c:3376)
==3601==    by 0x80AC21B: main (vdr.c:1078)

According to "monitor get_vbits", the cRect is totally uninitialized.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0810c0db in IsEmpty (this=0xbeba08a0) at osd.h:411
411	  bool IsEmpty(void) const { return Width() <= 0 || Height() <= 0; }
(gdb) up
#1  cRect::Intersected (this=this@entry=0xbeba08a0, Rect=...) at osd.c:912
912	  if (!IsEmpty() && !Rect.IsEmpty()) {
(gdb) up
#2  0x0810e3d2 in cPixmapMemory::DrawRectangle (this=0x6d3fe78, 
Rect=..., Color=2566914048) at osd.c:1333
1333	  cRect r = Rect.Intersected(DrawPort().Size());

As far as I can tell, the entirely uninitialized cRect is being passed 
as the Rect parameter to cPixmapMemory::DrawRectangle(). Unfortunately, 
gdb cannot show me the stack above that. It would seem to me that 
cSkinLCARSDisplayMenu::Clear() is passing uninitialized bounds to 
cOsd::DrawRectangle(), which will lead to funny values like this:

(gdb) p *this
$31 = {point = {x = 1418239204, y = 0}, size = {width = -1379480940, 
height = 201}, static Null = {point = {x = 0, y = 0}, size = {width = 0, 
height = 0}, static Null = <same as static member of an already seen 
type>}}

As a workaround, I guess that I will be switching away from the LCARS 
skin for now. I got into this exercise because vdr sometimes crashed 
when I pressed the Recordings or Menu button when using the LCARS skin.

I am also attaching my patch against softdevice CVS, in case someone 
finds it useful. I was unable to figure out how to clear the garbage at 
the bottom of the OSD screen. It goes away if the dfb:mgatv video 
display area is high enough (4:3 video instead of 16:9).

Best regards,

	Marko
Klaus Schmidinger - Nov. 15, 2013, 3:47 p.m.
On 15.11.2013 16:08, Marko Mäkelä wrote:
> ...
> BTW, !Track && x || Track && y
> should IMO be simpler written Track ? y : x.
>
> It looks like a memset() is missing from the cSkinLCARSDisplayReplay constructor. cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel() is doing the right thing:
>
>    memset(&lastTrackId, 0, sizeof(lastTrackId));
>
> Adding the memset() made this message go away. (Patch attached.)

Thanks, applied.

> The next problem is this one, which I get every time by pressing Play, Pause, Menu, Recordings after startup:
>
> ==3601== Conditional jump or move depends on uninitialised value(s)
> ==3601==    at 0x810C0DB: cRect::Intersected(cRect const&) const (osd.h:411)
> ==3601==    by 0x810E3D1: cPixmapMemory::DrawRectangle(cRect const&, unsigned int) (osd.c:1333)
> ==3601==    by 0x810AA0B: cOsd::DrawRectangle(int, int, int, int, unsigned int) (osd.c:1922)
> ==3601==    by 0x8130482: cSkinLCARSDisplayMenu::Clear() (skinlcars.c:1463)
> ==3601==    by 0x810651F: cOsdMenu::Display() (osdbase.c:223)
> ==3601==    by 0x80FA3D1: cMenuMain::Set() (menu.c:3432)
> ==3601==    by 0x80FA9FD: cMenuMain::cMenuMain(eOSState, bool) (menu.c:3376)
> ==3601==    by 0x80AC21B: main (vdr.c:1078)
>
> According to "monitor get_vbits", the cRect is totally uninitialized.
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x0810c0db in IsEmpty (this=0xbeba08a0) at osd.h:411
> 411      bool IsEmpty(void) const { return Width() <= 0 || Height() <= 0; }
> (gdb) up
> #1  cRect::Intersected (this=this@entry=0xbeba08a0, Rect=...) at osd.c:912
> 912      if (!IsEmpty() && !Rect.IsEmpty()) {
> (gdb) up
> #2  0x0810e3d2 in cPixmapMemory::DrawRectangle (this=0x6d3fe78, Rect=..., Color=2566914048) at osd.c:1333
> 1333      cRect r = Rect.Intersected(DrawPort().Size());
>
> As far as I can tell, the entirely uninitialized cRect is being passed as the Rect parameter to cPixmapMemory::DrawRectangle(). Unfortunately, gdb cannot show me the stack above that. It would seem to me that cSkinLCARSDisplayMenu::Clear() is passing uninitialized bounds to cOsd::DrawRectangle(),
> which will lead to funny values like this:
>
> (gdb) p *this
> $31 = {point = {x = 1418239204, y = 0}, size = {width = -1379480940, height = 201}, static Null = {point = {x = 0, y = 0}, size = {width = 0, height = 0}, static Null = <same as static member of an already seen type>}}

The constructor of cRect makes sure that all members are initialized to zero.
I'm afraid I can't think of a way there could be an uninitialized cRect.

Is there a reproducible set of actions that causes this to happen?

Klaus
Marko Mäkelä - Nov. 15, 2013, 5:17 p.m.
Hi Klaus,

On Fri, Nov 15, 2013 at 04:47:10PM +0100, Klaus Schmidinger wrote:
>>#2  0x0810e3d2 in cPixmapMemory::DrawRectangle (this=0x6d3fe78, 
>>Rect=..., Color=2566914048) at osd.c:1333
>>1333      cRect r = Rect.Intersected(DrawPort().Size());
>>
>>As far as I can tell, the entirely uninitialized cRect is being passed 
>>as the Rect parameter to cPixmapMemory::DrawRectangle(). 
>>Unfortunately, gdb cannot show me the stack above that. It would seem 
>>to me that cSkinLCARSDisplayMenu::Clear() is passing uninitialized 
>>bounds to cOsd::DrawRectangle(), which will lead to funny values like 
>>this:
>>
>>(gdb) p *this
>>$31 = {point = {x = 1418239204, y = 0}, size = {width = -1379480940, 
>>height = 201}, static Null = {point = {x = 0, y = 0}, size = {width = 
>>0, height = 0}, static Null = <same as static member of an already 
>>seen type>}}
>
>The constructor of cRect makes sure that all members are initialized to zero.
>I'm afraid I can't think of a way there could be an uninitialized cRect.

Sorry, I used a bit sloppy language. cRect appears to be initialized, 
but with uninitialized values. You know, Valgrind does not complain when 
you copy uninitialized data around. It only complains when you are 
comparing uninitialized data or passing uninitialized data to a system 
call. The Valgrind V-bits are tracking which bits are uninitialized.

The cRect constructor is not at fault. I tried this twice, but both 
times gdb would only show me the 3 topmost stack frames, claiming that 
the rest of the stack is corrupted. Valgrind did show more (quoting from 
my previous message):

==3601==    by 0x810AA0B: cOsd::DrawRectangle(int, int, int, int,
unsigned int) (osd.c:1922)
==3601==    by 0x8130482: cSkinLCARSDisplayMenu::Clear() 
(skinlcars.c:1463)

I could obviously not verify this (due to gdb claiming that the stack is 
corrupted), but I suspect that the parameters that are being passed are 
uninitialized:

void cSkinLCARSDisplayMenu::Clear(void)
{
   textScroller.Reset();
   osd->DrawRectangle(xi00, yi00, xi03 - 1, yi01 - 1, Theme.Color(clrBackground));
}

AFAICT, it is invoking this code in cOsd::DrawRectangle():
      pixmaps[0]->DrawRectangle(cRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1), Color);
This in turn should be invoking this constructor:
  cRect(int X, int Y, int Width, int Height): point(X, Y), size(Width, Height) {}

cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu() is not initializing any 
of the members xi00, yi00, xi03, yi01.

>Is there a reproducible set of actions that causes this to happen?

Yes. Hit Play (to start playing the last played recording), Pause, Menu, 
Recordings while using the LCARS skin. The first 2 or 3 keypresses ought 
to be optional. I had to stop the video playback with the 2 first 
keypresses, because the softdevice framerate is measured in seconds per 
frame when running under Valgrind :)

Best regards,

	Marko

Patch

Index: SoftOsd.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/SoftOsd.c,v
retrieving revision 1.37
diff -p -u -r1.37 SoftOsd.c
--- SoftOsd.c	17 Apr 2011 16:06:31 -0000	1.37
+++ SoftOsd.c	15 Nov 2013 15:03:17 -0000
@@ -25,7 +25,6 @@ 
 //#define SCALEDEBV(out...) printf(out)
 //#define SCALEDEBH(out...) printf(out)
 
-
 #ifndef OSDDEB
 #define OSDDEB(out...)
 #endif
@@ -55,16 +54,17 @@ 
 #define COLOR_64BIT(x) ( ((x)<<32) | (x) )
 #define ALPHA_VALUE(x) ( (x) << 24 )
 
-// the same constants for MMX mode
+//#undef USE_MMX
+//#undef USE_MMX2
+
+#ifdef USE_MMX2
 static uint64_t transparent_thr= COLOR_64BIT(ALPHA_VALUE(TRANSPARENT_THRESHOLD>>1));
 static uint64_t opacity_thr= COLOR_64BIT(ALPHA_VALUE(OPACITY_THRESHOLD>>1));
 static uint64_t pseudo_transparent = COLOR_64BIT(COLOR_KEY);
+#endif // USE_MMX2
 
 int cSoftOsd::colorkey;
 
-//#undef USE_MMX
-//#undef USE_MMX2
-
 #undef SPLAT_U16
 #ifdef USE_MMX2
 #define SPLAT_U16(X)   " pshufw $0b0, " X ", " X " \n"
@@ -77,69 +77,59 @@  int cSoftOsd::colorkey;
  */
 #if VDRVERSNUM >= 10509
 cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y, uint level)
-        : cOsd(X, Y, level),active(false),close(false) {
+        : cOsd(X, Y, level), shown(false) {
 #else
 cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y)
-        : cOsd(X, Y),active(false),close(false) {
+        : cOsd(X, Y), shown(false) {
 #endif
         OSDDEB("cSoftOsd constructor\n");
         OutputConvert=&cSoftOsd::ARGB_to_ARGB32;
         bitmap_Format=PF_None; // forces a clear after first SetMode
-        OSD_Bitmap=new uint32_t[OSD_STRIDE*(OSD_HEIGHT+4)];
+        OSD_Bitmap=new tColor[OSD_STRIDE*(OSD_HEIGHT+4)];
 
         videoOut = VideoOut;
         xPan = yPan = 0;
-        shown = false;
-        voutMutex.Lock();
         videoOut->OpenOSD();
         colorkey=videoOut->GetOSDColorkey();
+#ifdef USE_MMX2
         pseudo_transparent=(uint64_t)colorkey | ((uint64_t) colorkey)<<32;
+#endif // USE_MMX2
 
-        xOfs=X;yOfs=Y;
         ScreenOsdWidth=ScreenOsdHeight=0;
         int Depth=16; bool HasAlpha=false; bool AlphaInversed=false;
         bool IsYUV=false;
         videoOut->AdjustOSDMode();
         videoOut->GetOSDMode(Depth,HasAlpha,AlphaInversed,IsYUV);
         SetMode(Depth,HasAlpha,AlphaInversed,IsYUV);
-        voutMutex.Unlock();
 };
 
 /*--------------------------------------------------------------------------*/
 void cSoftOsd::Clear() {
         OSDDEB("Clear\n");
-        uint32_t blank=0x00000000; //COLOR_KEY;
+#if VDRVERSNUM >= 10509
+        if (!cOsd::Active()) return;
+#endif
+        tColor blank=tColor(COLOR_KEY);
         ConvertPalette((tColor *)&blank,(tColor *)&blank,1);
 
         register uint32_t fill=blank;
-        for (int i=OSD_STRIDE*(OSD_HEIGHT+2)-1; i!=0; i--)
-                OSD_Bitmap[i]=fill;
-        OSD_Bitmap[0]=fill;
 
-        // no dirty lines, everything has to be redrawn anyway
-        memset(dirty_lines,false,sizeof(dirty_lines));
+        if (fill == (fill & 0xff) * 0x1010101) {
+                memset(OSD_Bitmap, fill,
+                       OSD_STRIDE*(OSD_HEIGHT+4) * sizeof *OSD_Bitmap);
+        } else {
+                register tColor *b=OSD_Bitmap;
+                register const tColor *const e=b + OSD_STRIDE*(OSD_HEIGHT+4);
+                while (b < e) *b++=fill;
+        }
+
+        memset(dirty_lines,true,sizeof(dirty_lines));
 }
 
 /* --------------------------------------------------------------------------*/
 cSoftOsd::~cSoftOsd() {
         OSDDEB("cSoftOsd destructor\n");
-        close=true;
-        active=false;
         Cancel(3);
-        if (videoOut
-#if VDRVERSNUM >= 10509
-            && cOsd::Active()
-#endif
-            ) {
-                voutMutex.Lock();
-                videoOut->CloseOSD();
-#ifdef HAVE_YAEPGPATCH
-                if (vidWin.bpp!=0)
-                        videoOut->SetVidWin(0,0,0,0,0);
-#endif
-                videoOut=0;
-                voutMutex.Unlock();
-        }
         delete[] OSD_Bitmap;
 }
 
@@ -148,10 +138,6 @@  eOsdError cSoftOsd::SetAreas(const tArea
 {
         if (shown) {
                 Clear();
-#if VDRVERSNUM >= 10509
-                if (cOsd::Active())
-#endif
-                        videoOut->ClearOSD();
                 shown = false;
         }
         return cOsd::SetAreas(Areas, NumAreas);
@@ -176,22 +162,25 @@  void cSoftOsd::SetActive(bool On)
 /* -------------------------------------------------------------------------*/
 void cSoftOsd::Action() {
         OSDDEB("OSD thread started\n");
-        active=true;
-        while(active && videoOut && !close) {
+
+        voutMutex.Lock();
+
+        while (Running() && videoOut) {
                 int newOsdWidth;
                 int newOsdHeight;
                 int newXPan, newYPan;
 
-                voutMutex.Lock();
                 if (!videoOut
 #if VDRVERSNUM >= 10509
                     || !cOsd::Active()
 #endif
-                    ) {
+                ) {
+sleep:
                         voutMutex.Unlock();
                         usleep(17000);
+                        voutMutex.Lock();
                         continue;
-                };
+                }
 
                 videoOut->AdjustOSDMode();
                 videoOut->GetOSDDimension(newOsdWidth,newOsdHeight,newXPan,newYPan);
@@ -216,14 +205,22 @@  void cSoftOsd::Action() {
                                 ScreenOsdHeight!=newOsdHeight  ||
                                 modeChanged ) {
                         OSDDEB("Resolution or mode changed!\n");
-                        if (modeChanged)
-                                videoOut->ClearOSD();
                         OsdCommit();
                 }
-                voutMutex.Unlock();
 
-                usleep(17000);
+                goto sleep;
         }
+
+        if (
+#if VDRVERSNUM >= 10509
+            cOsd::Active()
+#else
+            true
+#endif
+        ) {
+                if (videoOut) videoOut->ClearOSD();
+        }
+        voutMutex.Unlock();
         OSDDEB("OSD thread ended\n");
 }
 
@@ -373,9 +370,7 @@  void cSoftOsd::Flush(void) {
         pthread_yield();
 #endif
 
-        if (!active && !close)
-                Start();
-
+        Start();
         shown = true;
 }
 
@@ -385,8 +380,16 @@  bool cSoftOsd::FlushBitmaps(bool OnlyDir
         bool OSD_changed=false;
         OSDDEB("FlushBitmaps (OnlyDirty: %d)\n",OnlyDirty);
 
-        for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
-                OSD_changed |= DrawConvertBitmap(Bitmap,OnlyDirty);
+        if (IsTrueColor()) {
+                LOCK_PIXMAPS;
+                while (cPixmapMemory *pm = RenderPixmaps()) {
+                        OSD_changed |= DrawConvertPixmap(pm);
+                        delete pm;
+                }
+        } else {
+                for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
+                        OSD_changed |= DrawConvertBitmap(Bitmap,OnlyDirty);
+                }
         }
         return OSD_changed;
 };
@@ -435,7 +438,7 @@  bool cSoftOsd::DrawConvertBitmap(cBitmap
         cMutexLock dirty(&dirty_Mutex);
         OSDDEB("DrawConvertBitmap %p, OnlyDirty %d\n",bitmap,OnlyDirty);
 
-        if ( !bitmap->Dirty(x1,y1,x2,y2) && OnlyDirty)
+        if (OnlyDirty && !bitmap->Dirty(x1,y1,x2,y2))
                 return false;
 
         if (!OnlyDirty) {
@@ -458,14 +461,14 @@  bool cSoftOsd::DrawConvertBitmap(cBitmap
 
         y2++;
         x2++;
-        y2= yOfs+y2+bitmap->Y0() > OSD_HEIGHT ?
-                OSD_HEIGHT-bitmap->Y0()-yOfs : y2;
-        x2= xOfs+x2+bitmap->X0() > OSD_WIDTH ?
-                OSD_WIDTH-bitmap->X0()-xOfs : x2;
+        y2= Top()+y2+bitmap->Y0() > OSD_HEIGHT ?
+                OSD_HEIGHT-bitmap->Y0()-Top() : y2;
+        x2= Left()+x2+bitmap->X0() > OSD_WIDTH ?
+                OSD_WIDTH-bitmap->X0()-Left() : x2;
 
-        int bitmap_yOfs=yOfs+bitmap->Y0()+Y_OFFSET;
+        int bitmap_yOfs=Top()+bitmap->Y0();
         uint32_t *OSD_pointer=&OSD_Bitmap[(bitmap_yOfs+y1)*OSD_STRIDE+
-                xOfs+bitmap->X0()+x1+X_OFFSET];
+                Left()+bitmap->X0()+x1];
         int missing_line_length=OSD_STRIDE-(x2-x1);
         bool *dirty_line=&dirty_lines[bitmap_yOfs+y1];
 
@@ -480,6 +483,42 @@  bool cSoftOsd::DrawConvertBitmap(cBitmap
         return true;
 };
 
+bool cSoftOsd::DrawConvertPixmap(cPixmapMemory *pm)
+{
+        int x1,x2,y1,y2;
+        const tColor *src=reinterpret_cast<const tColor*>(pm->Data());
+        OSDDEB("DrawConvertPixmap %p\n",pm);
+
+        x1=Left();
+        y1=Top();
+
+        x1+=pm->ViewPort().X();
+        x2=x1 + pm->ViewPort().Width();
+        y1+=pm->ViewPort().Y();
+        y2=y1 + pm->ViewPort().Height();
+        src+=pm->DrawPort().X() + pm->DrawPort().Y() * pm->DrawPort().Width();
+
+        OSDDEB("drawing pixmap %p from (%d,%d) to (%d,%d)\n",
+                        pm,x1,y1,x2,y2);
+
+        if (y1 > OSD_HEIGHT) y1=OSD_HEIGHT;
+        if (x1 > OSD_WIDTH) x1=OSD_WIDTH;
+        if (y2 > OSD_HEIGHT) y2=OSD_HEIGHT;
+        if (x2 > OSD_WIDTH) x2=OSD_WIDTH;
+
+        cMutexLock dirty(&dirty_Mutex);
+
+        tColor *dst=&OSD_Bitmap[y1*OSD_STRIDE+x1];
+
+        for (int y=y1; y<y2; dirty_lines[y++] = true) {
+                memcpy(dst, src, (x2 - x1) * sizeof(tColor));
+                src += pm->DrawPort().Width();
+                dst += OSD_STRIDE;
+        }
+
+        return y1 != y2;
+}
+
 /*----------------------------------------------------------------------*/
 
 void cSoftOsd::ARGB_to_AYUV(uint32_t * dest, color * pixmap, int Pixel) {
Index: SoftOsd.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/SoftOsd.h,v
retrieving revision 1.21
diff -p -u -r1.21 SoftOsd.h
--- SoftOsd.h	17 Apr 2011 17:22:18 -0000	1.21
+++ SoftOsd.h	15 Nov 2013 15:03:17 -0000
@@ -17,11 +17,11 @@ 
 #include <vdr/thread.h>
 
 // osd some constants and macros
-#define OPACITY_THRESHOLD 0x9FLL
-#define TRANSPARENT_THRESHOLD 0x1FLL
+#define OPACITY_THRESHOLD 0x1FLL
+#define TRANSPARENT_THRESHOLD 0x0FLL
 #define COLOR_KEY 0x00000000LL
 
-#if VDRVERSNUM <= 10707
+#if 1//VDRVERSNUM <= 10707
 
 #define OSD_WIDTH   720
 #define OSD_HEIGHT  576
@@ -35,18 +35,11 @@ 
 
 #endif
 
-#define IS_BACKGROUND(a) (((a) < OPACITY_THRESHOLD) && ((a) > TRANSPARENT_THRESHOLD))
+#define IS_BACKGROUND(a) (((a) < OPACITY_THRESHOLD) && ((a) >= TRANSPARENT_THRESHOLD))
 #define IS_TRANSPARENT(a) ((a) < TRANSPARENT_THRESHOLD)
-#define IS_OPAQUE(a) ((a) > OPACITY_THRESHOLD)
 
 #include "video.h"
 
-#define X_OFFSET 0
-#define Y_OFFSET 0
-
-
-#define COLOR_RGB16(r,g,b) (((b >> 3)& 0x1F) | ((g & 0xF8) << 2)| ((r & 0xF8)<<10) )
-
 #define GET_A(x) ((x) >> 24 & 0xFF)
 #define GET_R(x) ((x) >> 16 & 0xFF)
 #define GET_G(x) ((x) >>  8 & 0xFF)
@@ -56,31 +49,23 @@ 
 #define SET_R(x) ((x) << 16 & 0x00FF0000)
 #define SET_G(x) ((x) <<  8 & 0x0000FF00)
 #define SET_B(x) ((x) <<  0 & 0x000000FF)
-/*
-struct color {
-    unsigned char b;
-    unsigned char g;
-    unsigned char r;
-    unsigned char a;
-};
-*/
-typedef uint32_t color;
+
+typedef tColor color;
 
 class cVideoOut;
 
 /* ---------------------------------------------------------------------------
  */
-class cSoftOsd : public cOsd,cThread {
+class cSoftOsd : public cOsd, cThread {
 private:
     cMutex voutMutex; // lock all operations on videoOut!
     cVideoOut *videoOut;
 protected:
     static int colorkey;
-    int      xOfs, yOfs;
     int      xPan, yPan;
-    uint32_t *OSD_Bitmap;
     bool dirty_lines[OSD_HEIGHT+10];
     cMutex dirty_Mutex;
+    tColor*  OSD_Bitmap;
 
     void (*OutputConvert)(uint8_t * dest, color * pixmap, int Pixel, int odd);
     enum PixFormat {
@@ -96,8 +81,6 @@  protected:
     void ConvertPalette(tColor *dest_palette, const tColor *orig_palette,
                     int maxColors);
 
-    bool active;
-    bool close;
     bool shown;
     int ScreenOsdWidth;
     int ScreenOsdHeight;
@@ -126,6 +109,7 @@  protected:
 
     bool FlushBitmaps(bool OnlyDirty);
     bool DrawConvertBitmap(cBitmap *Bitmap, bool OnlyDirty);
+    bool DrawConvertPixmap(cPixmapMemory* pm);
 
     void OsdCommit(bool forced = false);
     // may only be called if the caller holds voutMutex
Index: VideoFilter.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/VideoFilter.c,v
retrieving revision 1.11
diff -p -u -r1.11 VideoFilter.c
--- VideoFilter.c	18 Apr 2008 15:10:35 -0000	1.11
+++ VideoFilter.c	15 Nov 2013 15:03:17 -0000
@@ -286,7 +286,7 @@  void cImageConvert::Filter(sPicBuffer *&
 #ifdef USE_SWSCALE
        sws_scale(img_convert_ctx, avpic_src.data, avpic_src.linesize,
                         0, orig->height, avpic_dest.data, avpic_dest.linesize);
-#else
+#elif 0
         if (img_convert(&avpic_dest,PIX_FMT_YUV420P,
                                 &avpic_src, orig->format,
                                 orig->width, orig->height) < 0) {
@@ -295,6 +295,9 @@  void cImageConvert::Filter(sPicBuffer *&
                                 "[softdevice] error, libavcodec img_convert failure\n");
                 return;
         }
+#else
+	dest = orig;
+	return;
 #endif
         CopyPicBufferContext(dest,orig);
 }
Index: configure
===================================================================
RCS file: /cvsroot/softdevice/softdevice/configure,v
retrieving revision 1.50
diff -p -u -r1.50 configure
--- configure	21 Sep 2008 12:55:57 -0000	1.50
+++ configure	15 Nov 2013 15:03:17 -0000
@@ -218,7 +218,7 @@  if test "${use_pkgconfig}" = "yes" ; the
   if test "${ffmpeg_use_path}" = "no" ; then
 
 echo "try to use pkg-config." >> config.log
-ffmpeg_l1="libavformat libavcodec"
+ffmpeg_l1="libavformat libavcodec libavutil zlib"
 
 pkg-config --libs libpostproc >> config.log 2>&1 && { ffmpeg_l1="$ffmpeg_l1 libpostproc";libpostproc="yes"; }
 
Index: i18n.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/i18n.c,v
retrieving revision 1.25
diff -p -u -r1.25 i18n.c
--- i18n.c	14 Apr 2008 02:28:09 -0000	1.25
+++ i18n.c	15 Nov 2013 15:03:18 -0000
@@ -7,6 +7,7 @@ 
  */
 
 #include "i18n.h"
+#if 0
 
 const tI18nPhrase Phrases[] = {
   { "Softdevice",   //  1
@@ -1343,3 +1344,4 @@  const tI18nPhrase Phrases[] = {
   },
   { NULL }
   };
+#endif
Index: i18n.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/i18n.h,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 i18n.h
--- i18n.h	1 Aug 2004 05:07:04 -0000	1.1.1.1
+++ i18n.h	15 Nov 2013 15:03:18 -0000
@@ -11,6 +11,4 @@ 
 
 #include <vdr/i18n.h>
 
-extern const tI18nPhrase Phrases[];
-
 #endif //_I18N__H
Index: mpeg2decoder.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/mpeg2decoder.c,v
retrieving revision 1.90
diff -p -u -r1.90 mpeg2decoder.c
--- mpeg2decoder.c	17 Apr 2011 17:22:18 -0000	1.90
+++ mpeg2decoder.c	15 Nov 2013 15:03:18 -0000
@@ -162,7 +162,7 @@  cStreamDecoder::cStreamDecoder(AVCodecCo
 #if HAS_ERROR_RECOGNITION
         context->error_recognition=1;
 #else
-        context->error_resilience=1;
+        context->error_concealment=1;
 #endif
   CMDDEB("Neuer StreamDecoder Pid: %d context %p type %d\n",
         getpid(),context,context->codec_type );
Index: shm-common.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/shm-common.h,v
retrieving revision 1.9
diff -p -u -r1.9 shm-common.h
--- shm-common.h	10 May 2007 19:49:51 -0000	1.9
+++ shm-common.h	15 Nov 2013 15:03:18 -0000
@@ -81,14 +81,14 @@  struct ShmCtlBlock {
         int setup_shmid;
 };
 
-inline void sem_wait_lock(int semid, int idx, int flag=0) 
+inline void sem_wait_lock(int semid, unsigned short idx, short int flag=0) 
 {
         struct sembuf sem_op = { idx, -1, flag };
         
         semop(semid, &sem_op,1);
 };
 
-inline void sem_sig_unlock(int semid, int idx,int flag=0) 
+inline void sem_sig_unlock(int semid, unsigned short idx, short int flag=0) 
 {
         struct sembuf sem_op = { idx, 1, flag };
         
Index: softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.c,v
retrieving revision 1.99
diff -p -u -r1.99 softdevice.c
--- softdevice.c	17 Apr 2011 17:22:19 -0000	1.99
+++ softdevice.c	15 Nov 2013 15:03:19 -0000
@@ -1306,7 +1306,7 @@  bool cPluginSoftDevice::Service(const ch
 bool cPluginSoftDevice::Start(void)
 {
   // Start any background activities the plugin shall perform.
-  RegisterI18n(Phrases);
+  I18nRegister("softdevice");
   return true;
 }
 
Index: sync-timer.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/sync-timer.h,v
retrieving revision 1.5
diff -p -u -r1.5 sync-timer.h
--- sync-timer.h	25 Mar 2007 08:54:12 -0000	1.5
+++ sync-timer.h	15 Nov 2013 15:03:19 -0000
@@ -39,7 +39,7 @@  class cSigTimer : public cRelTimer {
      bool got_signal;
 
    public:
-      cSigTimer() : cRelTimer()
+      cSigTimer() : cRelTimer(), got_signal(false)
       {
         pthread_mutex_init(&mutex, NULL);
         pthread_cond_init(&cond, NULL);
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.86
diff -p -u -r1.86 video-dfb.c
--- video-dfb.c	14 Jun 2009 18:00:58 -0000	1.86
+++ video-dfb.c	15 Nov 2013 15:03:19 -0000
@@ -183,7 +183,19 @@  static DFBEnumerationResult EnumVideoMod
 /* ---------------------------------------------------------------------------
  */
 cDFBVideoOut::cDFBVideoOut(cSetupStore *setupStore, cSetupSoftlog *softlog)
-              : cVideoOut(setupStore, softlog)
+              : cVideoOut(setupStore, softlog),
+ osdLayer(0),videoLayer(0),scrDsc(),osdDsc(),vidDsc(),
+ osdLayerDescription(),videoLayerDescription(),osdLayerConfiguration(),
+ osdSurface(0),videoSurface(0),scrSurface(0),
+ pixelformat(),dfbRemote(0),events(0),
+ deinterlace(false),alphablend(false),
+ useStretchBlit(false),useSetSourceRectangle(false),
+ osdClrBack(false),isVIAUnichrome(false),
+ clearAlpha(0),
+ clearBackCount(2), // by default for double buffering
+ clearBackground(0),
+ prevOsdMode(setupStore->osdMode),videoLayerLevel(1),
+ dirtyLines(0),tmpOsdSurface(0)
 {
     tLayerSelectItem              *layerInfo;
 
@@ -195,16 +207,9 @@  cDFBVideoOut::cDFBVideoOut(cSetupStore *
   swidth  = fwidth  = 720;
   sheight = fheight = 576;
 
-  tmpOsdSurface = NULL;
   screenPixelAspect = -1;
   currentPixelFormat = setupStore->pixelFormat;
-  prevOsdMode = setupStore->osdMode;
   setupStore->osdMode = 0;
-  isVIAUnichrome = false;
-  clearAlpha = 0x00;
-  clearBackground = 0;
-  clearBackCount = 2; // by default for double buffering;
-  videoLayerLevel = 1;
   OSDpresent = false;
 
   if(setupStore->viaTv)
@@ -1054,7 +1059,7 @@  void cDFBVideoOut::SetParams()
             videoSurface->Release();
           }
           if (setupStore->useMGAtv) {
-            vidDsc.caps = DFB_ADD_SURFACE_CAPS(vidDsc.caps, DSCAPS_INTERLACED);
+            DFB_ADD_SURFACE_CAPS(vidDsc.caps, DSCAPS_INTERLACED);
           }
 
           videoSurface=dfb->CreateSurface(vidDsc);
@@ -1120,16 +1125,15 @@  void cDFBVideoOut::Pause(void)
 
 /* ----------------------------------------------------------------------------
  */
-void cDFBVideoOut::OpenOSD ()
+void cDFBVideoOut::ClearOSD()
 {
-    IDirectFBSurface  *tmpSurface;
-
   if (!videoInitialized)
     return;
 
-  cVideoOut::OpenOSD();
   try
   {
+    IDirectFBSurface  *tmpSurface;
+
     tmpSurface = (useStretchBlit) ? osdSurface : scrSurface;
     tmpSurface->Clear(0,0,0,clearAlpha);
     tmpSurface->Flip();
@@ -1138,7 +1142,7 @@  void cDFBVideoOut::OpenOSD ()
   catch (DFBException *ex)
   {
     softlog->Log(SOFT_LOG_ERROR, 0,
-              "[dfb] OpenOSD: action=%s, result=%s\n",
+              "[dfb] ClearOSD: action=%s, result=%s\n",
               ex->GetAction(), ex->GetResult());
     delete ex;
   }
@@ -1221,14 +1225,14 @@  void cDFBVideoOut::CommitUnlockOsdSurfac
     int maxy=0;
     tmpOsdSurface->SetBlittingFlags(DSBLIT_NOFX);
     do {
-      while (!dirtyLines[miny] && miny < Yres)
+      while (miny < Yres && !dirtyLines[miny])
         miny++;
 
       if (miny >= Yres)
         break;
 
       maxy=miny;
-      while (dirtyLines[maxy] && maxy < Yres)
+      while (maxy < Yres && dirtyLines[maxy])
         maxy++;
 
       osdsrc.x = 0;
@@ -1289,39 +1293,8 @@  bool cDFBVideoOut::IsSoftOSDMode()
  */
 void cDFBVideoOut::CloseOSD()
 {
-    IDirectFBSurface  *tmpSurface;
-
-  if (!videoInitialized)
-    return;
-
+  ClearOSD();
   cVideoOut::CloseOSD();
-  tmpSurface = (useStretchBlit) ? osdSurface : scrSurface;
-  try
-  {
-    if (useStretchBlit)
-    {
-      OSDpresent  = false;
-      clearBackground = clearBackCount;
-      tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-    }
-    else
-    {
-      tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-      tmpSurface->Flip(); // Flip the field
-      if (!isVIAUnichrome)
-      {
-        tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-        tmpSurface->Flip(); // Flip the field
-      }
-    }
-  }
-  catch (DFBException *ex)
-  {
-    softlog->Log(SOFT_LOG_ERROR, 0,
-              "[dfb] CloseOSD: action=%s, result=%s\n",
-              ex->GetAction(), ex->GetResult());
-    delete ex;
-  }
 }
 
 /* ---------------------------------------------------------------------------
Index: video-dfb.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.h,v
retrieving revision 1.30
diff -p -u -r1.30 video-dfb.h
--- video-dfb.h	14 Jun 2009 18:00:58 -0000	1.30
+++ video-dfb.h	15 Nov 2013 15:03:19 -0000
@@ -74,7 +74,7 @@  class cDFBVideoOut : public cVideoOut {
 
     bool *dirtyLines;
     IDirectFBSurface  *tmpOsdSurface;
-    virtual void OpenOSD();
+    virtual void ClearOSD();
     virtual void GetOSDMode(int &Depth, bool &HasAlpha, bool &AlphaInversed,
                             bool &IsYUV);
     virtual void GetOSDDimension(int &OsdWidth,int &OsdHeight,
Index: video-shm.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-shm.c,v
retrieving revision 1.20
diff -p -u -r1.20 video-shm.c
--- video-shm.c	13 Oct 2007 11:17:48 -0000	1.20
+++ video-shm.c	15 Nov 2013 15:03:19 -0000
@@ -238,7 +238,7 @@  void cShmVideoOut::CheckShmIDs() {
                                 case PIX_FMT_YUV422:
                                         SHMDEB("new format YUV422\n");
                                         privBuf.pixel[0]=curr_pict+ctl->offset0;
-                                        privBuf.pixel[1]=privBuf.pixel[1]=NULL;
+                                        privBuf.pixel[1]=privBuf.pixel[2]=NULL;
                                         privBuf.stride[0]=ctl->stride0;
                                         privBuf.stride[1]=privBuf.stride[2]=0;
                                         break;
Index: video.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.c,v
retrieving revision 1.80
diff -p -u -r1.80 video.c
--- video.c	17 Apr 2011 17:22:19 -0000	1.80
+++ video.c	15 Nov 2013 15:03:20 -0000
@@ -53,6 +53,9 @@  cVideoOut::cVideoOut(cSetupStore *setupS
   freezeMode=false;
   videoInitialized = false;
   oldPicture = NULL;
+  zoomCenterX = zoomCenterY = 0;
+  expandTopBottom = expandLeftRight = 0;
+  frametime = 0;
 
   hurryUp = 0;
   delay   = 0;
@@ -65,6 +68,7 @@  cVideoOut::cVideoOut(cSetupStore *setupS
   offsetClampHigh =   2;
   offsetUse       =   1;
   useAverage4Drop =   false;
+  current_osdMode = OSDMODE_PSEUDO;
 
   for (int i = 0; i < SETUP_VIDEOASPECTNAMES_COUNT; ++i)
     parValues [i] = 1.0;
Index: video.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.h,v
retrieving revision 1.60
diff -p -u -r1.60 video.h
--- video.h	17 Apr 2011 17:22:19 -0000	1.60
+++ video.h	15 Nov 2013 15:03:20 -0000
@@ -28,7 +28,7 @@ 
 #define DV_FORMAT_NORMAL  1
 #define DV_FORMAT_WIDE    2
 
-#if  VDRVERSNUM <= 10707
+#if 1//VDRVERSNUM <= 10707
 
 #define OSD_FULL_WIDTH    736
 #define OSD_FULL_HEIGHT   576

Privacy Policy