Patch: dxr3plugin OSD don't turn pink

Message ID 1112217417.31596.17.camel@bobcat.mine.nu
State New
Headers

Commit Message

Ville Skyttä March 30, 2005, 9:16 p.m. UTC
  On Wed, 2005-03-30 at 13:48 +0200, Martin Cap wrote:

> Attached to this posting is a patch which fixes the odd problem making 
> the osd
> turn pink after returning from mplayer or after hardware-reset of the 
> dxr3-card.
> I posted this fix in a german-vdr-forum a couple of months ago and it
> works for other users there, too. I haven't found the time to post it 
> here (other users hadn't either:) )...  so,
> here it is.

Yep, works for me too, thanks.

However, the patch gave me the creeps, so I dug a little deeper.  I
found that the only thing needed to fix the pink OSD here was to comment
out the "m_users[i] == 0" test in AddColor() and unconditionally setting
m_changed to true there, or to set it to true in GetIndex() when the
color was found.  Both of those were still ugly.  Then I noticed that
the counters in m_users were not being reset to zero when they IMO
should have been, and came up with the attached patch which I think
would be more appropriate.  (Also applied to the vdr-dxr3-0-2 branch in
CVS.)

With this one applied, I no longer get pink OSD after returning from the
MPlayer plugin.  But after "Reset DXR3", the OSD is still momentarily
pink immediately after; things return to normal when the OSD is
hidden/shown again.

Reviews/testing welcome...
  

Comments

Martin Cap March 31, 2005, 7:15 a.m. UTC | #1
Hi Ville,

Well, even better. Works.


Ville Skyttä wrote:

> Reviews/testing welcome...
>
  
Luca Olivetti April 2, 2005, 9:32 a.m. UTC | #2
Ville Skyttä wrote:


> With this one applied, I no longer get pink OSD after returning from the
> MPlayer plugin.  But after "Reset DXR3", the OSD is still momentarily
> pink immediately after; things return to normal when the OSD is
> hidden/shown again.
> 
> Reviews/testing welcome...

Try to use the yaepg plugin: after that the normal osd (only with the 
st:tng skin) starts doing strange things here (reproducible), like 
discontinuous transparent background, a small rectangle black in the 
lower right corner of the channel name in the channel info display and 
thinner than normal selected lines. Without the patch it doesn't happen.

Bye
  
Martin Cap April 2, 2005, 10:05 a.m. UTC | #3
Hi,

how about the "original" patch I posted ? Does it happen there ?

Regards,
  
Luca Olivetti April 2, 2005, 10:23 a.m. UTC | #4
Martin Cap wrote:
> Hi,
> 
> how about the "original" patch I posted ? Does it happen there ?

No, it doesn't, but the femon plugin doesn't work anymore with the 
elchi, deepblue or moronimo skins (only the "classic" one works with 
this patch).

Bye
  
Luca Olivetti April 2, 2005, 10:35 a.m. UTC | #5
Luca Olivetti wrote:
> Martin Cap wrote:
> 
>> Hi,
>>
>> how about the "original" patch I posted ? Does it happen there ?
> 
> 
> No, it doesn't, but the femon plugin doesn't work anymore with the 
> elchi, deepblue or moronimo skins (only the "classic" one works with 
> this patch).

Wait, it doesn't work even without your patch, it works only with 
Ville's patch.

Bye
  
Luca Olivetti April 2, 2005, 10:43 a.m. UTC | #6
Luca Olivetti wrote:
> Luca Olivetti wrote:
> 
>> Martin Cap wrote:
>>
>>> Hi,
>>>
>>> how about the "original" patch I posted ? Does it happen there ?
>>
>>
>>
>> No, it doesn't, but the femon plugin doesn't work anymore with the 
>> elchi, deepblue or moronimo skins (only the "classic" one works with 
>> this patch).
> 
> 
> Wait, it doesn't work even without your patch, it works only with 
> Ville's patch.

Ville's patch also fixes some colours in some pages with the osd 
teletext plugin, your doesn't (i.e. it seems it can manage more colours 
on larger areas at once). Pity for the problem after using the yaepg plugin.

Bye
  
Luca Olivetti April 2, 2005, 10:47 a.m. UTC | #7
Luca Olivetti wrote:
> Luca Olivetti wrote:
> 
>> Luca Olivetti wrote:
>>
>>> Martin Cap wrote:
>>>
>>>> Hi,
>>>>
>>>> how about the "original" patch I posted ? Does it happen there ?
>>>
>>>
>>>
>>>
>>> No, it doesn't, but the femon plugin doesn't work anymore with the 
>>> elchi, deepblue or moronimo skins (only the "classic" one works with 
>>> this patch).
>>
>>
>>
>> Wait, it doesn't work even without your patch, it works only with 
>> Ville's patch.
> 
> 
> Ville's patch also fixes some colours in some pages with the osd 
> teletext plugin, your doesn't (i.e. it seems it can manage more colours 
> on larger areas at once). Pity for the problem after using the yaepg 
> plugin.

I'm lost now. I'm testing your patch and the femon plugin shows 
correctly with the elchi skin if it's the first one shown, afterwards 
the yaepg plugin doesn't work (all black). Viceversa, if I use the yaepg 
plugin first after a restart it's the one working fine but the femon 
plugin show its texts black with the elchi skin.

Bye
  
Luca Olivetti April 2, 2005, 10:51 a.m. UTC | #8
Luca Olivetti wrote:

>> Ville's patch also fixes some colours in some pages with the osd 
>> teletext plugin, your doesn't (i.e. it seems it can manage more 
>> colours on larger areas at once). Pity for the problem after using the 
>> yaepg plugin.
> 
> 
> I'm lost now. I'm testing your patch and the femon plugin shows 
> correctly with the elchi skin if it's the first one shown, afterwards 
> the yaepg plugin doesn't work (all black). Viceversa, if I use the yaepg 
> plugin first after a restart it's the one working fine but the femon 
> plugin show its texts black with the elchi skin.

But then, it's the same even without your patch, so it's not making 
things worse.

Bye
  
Ville Skyttä April 2, 2005, 1:33 p.m. UTC | #9
On Sat, 2005-04-02 at 12:51 +0200, Luca Olivetti wrote:
> Luca Olivetti wrote:
> 
> >> Ville's patch also fixes some colours in some pages with the osd 
> >> teletext plugin, your doesn't (i.e. it seems it can manage more 
> >> colours on larger areas at once). Pity for the problem after using the 
> >> yaepg plugin.

Yep, that's expected.  Before the patch, colors weren't being "freed" in
OSD_Close, but were left reserved even though nothing in the OSD was
using them any more.  That obviously resulted in the whole whopping
limit of 16 colors reaching the top sooner than supposed.

> > I'm lost now. I'm testing your patch and the femon plugin shows 
> > correctly with the elchi skin if it's the first one shown, afterwards 
> > the yaepg plugin doesn't work (all black). Viceversa, if I use the yaepg 
> > plugin first after a restart it's the one working fine but the femon 
> > plugin show its texts black with the elchi skin.
> 
> But then, it's the same even without your patch, so it's not making 
> things worse.

Since you're tinkering with the palette stuff, here's something I
noticed while looking at Martin's patch:

cDxr3PaletteManager::GetIndex() is supposed to return the index of a
given color in the current palette.  If the given color is not found, it
returns 0, which doesn't make sense to me.  It should probably return -1
or something that isn't a valid index.  The return value of GetIndex()
is used in cSPUEncoder::Cmd(), the OSD_SetPalette case in the big switch
statement.

Now, what should be done there if an invalid index is returned (ie. the
color is not found in the current palette) is beyond me.  Blindly using
the returned 0 which is either the first color in the palette or a
nonexistent color seems clearly wrong and will almost certainly cause
some "effects"... ideas and especially patches welcome :)
  
Luca Olivetti April 2, 2005, 4:47 p.m. UTC | #10
Ville Skyttä wrote:
> On Sat, 2005-04-02 at 12:51 +0200, Luca Olivetti wrote:
> 
>>Luca Olivetti wrote:
>>
>>
>>>>Ville's patch also fixes some colours in some pages with the osd 
>>>>teletext plugin, your doesn't (i.e. it seems it can manage more 
>>>>colours on larger areas at once). Pity for the problem after using the 
>>>>yaepg plugin.
> 
> 
> Yep, that's expected.  Before the patch, colors weren't being "freed" in
> OSD_Close, but were left reserved even though nothing in the OSD was
> using them any more.  That obviously resulted in the whole whopping
> limit of 16 colors reaching the top sooner than supposed.

Since freeing colours should be better, then why the strange problem 
after using the yaepg plugin?

Bye
  
Ville Skyttä April 2, 2005, 5:11 p.m. UTC | #11
On Sat, 2005-04-02 at 18:47 +0200, Luca Olivetti wrote:
> Ville Skyttä wrote:
>
> > Yep, that's expected.  Before the patch, colors weren't being "freed" in
> > OSD_Close, but were left reserved even though nothing in the OSD was
> > using them any more.  That obviously resulted in the whole whopping
> > limit of 16 colors reaching the top sooner than supposed.
> 
> Since freeing colours should be better, then why the strange problem 
> after using the yaepg plugin?

Beats me, I've never looked at yaepg... perhaps it's not closing the OSD
properly or something.
  
Luca Olivetti April 3, 2005, 11:24 a.m. UTC | #12
Ville Skyttä wrote:
> On Sat, 2005-04-02 at 18:47 +0200, Luca Olivetti wrote:
> 
>>Ville Skyttä wrote:
>>
>>
>>>Yep, that's expected.  Before the patch, colors weren't being "freed" in
>>>OSD_Close, but were left reserved even though nothing in the OSD was
>>>using them any more.  That obviously resulted in the whole whopping
>>>limit of 16 colors reaching the top sooner than supposed.
>>
>>Since freeing colours should be better, then why the strange problem 
>>after using the yaepg plugin?
> 
> 
> Beats me, I've never looked at yaepg... perhaps it's not closing the OSD
> properly or something.

Ok, your fix is wrong, I have (what seems to be) the correct one. I will 
try it a bit more, clean it up a bit and send it later.

Bye
  

Patch

Index: dxr3interface_spu_encoder.c
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/Attic/dxr3interface_spu_encoder.c,v
retrieving revision 1.1.2.5
diff -u -U2 -r1.1.2.5 dxr3interface_spu_encoder.c
--- dxr3interface_spu_encoder.c	30 Mar 2005 20:18:13 -0000	1.1.2.5
+++ dxr3interface_spu_encoder.c	30 Mar 2005 21:05:40 -0000
@@ -450,4 +450,5 @@ 
 		// This should be done in cSPUEncoder::cSPUEncoder
 
+		m_palManager.Clear();
 		return 0;
 		break;
Index: dxr3palettemanager.c
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/dxr3palettemanager.c,v
retrieving revision 1.1.2.2
diff -u -U2 -r1.1.2.2 dxr3palettemanager.c
--- dxr3palettemanager.c	30 Mar 2005 20:34:26 -0000	1.1.2.2
+++ dxr3palettemanager.c	30 Mar 2005 21:05:41 -0000
@@ -114,2 +114,8 @@ 
     return m_pal;
 } 
+
+// ==================================
+void cDxr3PaletteManager::Clear()
+{
+    memset(m_users, 0, sizeof(int) * MAX_COLORS);
+}
Index: dxr3palettemanager.h
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/dxr3palettemanager.h,v
retrieving revision 1.1
diff -u -U2 -r1.1 dxr3palettemanager.h
--- dxr3palettemanager.h	5 Aug 2004 23:05:21 -0000	1.1
+++ dxr3palettemanager.h	30 Mar 2005 21:05:41 -0000
@@ -23,4 +23,5 @@ 
     void AddColor(int color);
     void RemoveColor(int color);
+    void Clear();
     int GetCount();
     int operator[](int index);