[PATCH] Let vo directx survive screensaver
Hi, Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2006/10/23, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window.
No comments for this? IMHO it fixed a long-standing bug. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hello, On Sun, Oct 29, 2006 at 02:58:55PM +0800, Zuxy Meng wrote:
No comments for this? IMHO it fixed a long-standing bug.
I find it ugly. IMO image should not be null. What does vo_directx try to do? Disable playback when the screensaver runs? If yes, just remove that feature, I don't care if the video plays on to of the screensaver. Greetings, Reimar Döffinger
Hi, 2006/10/29, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de>:
Hello, On Sun, Oct 29, 2006 at 02:58:55PM +0800, Zuxy Meng wrote:
No comments for this? IMHO it fixed a long-standing bug.
I find it ugly. IMO image should not be null. What does vo_directx try to do? Disable playback when the screensaver runs? If yes, just remove that feature, I don't care if the video plays on to of the screensaver.
flip_page() will fail to get a surface when screensaver runs, thus image will become zero. Dereferencing it results in segfault. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, On Monday 06 November 2006 13:08, Zuxy Meng wrote:
Hi,
2006/10/29, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de>:
Hello,
On Sun, Oct 29, 2006 at 02:58:55PM +0800, Zuxy Meng wrote:
No comments for this? IMHO it fixed a long-standing bug.
I find it ugly. IMO image should not be null. What does vo_directx try to do? Disable playback when the screensaver runs? If yes, just remove that feature, I don't care if the video plays on to of the screensaver.
flip_page() will fail to get a surface when screensaver runs, thus image will become zero. Dereferencing it results in segfault.
Did you test reimars patch? The fewer workarounds get added the better. Regards Sascha
Hi, 2006/11/9, Sascha Sommer <saschasommer@freenet.de>:
Hi,
Did you test reimars patch? The fewer workarounds get added the better.
Unfortunately Reimar's patch doesn't work: no segfault when screensaver is activated, but mplayer's audio output gets into a dead loop, playing a short piece again and again; when escaped from screensaver, mplayer's video output is unable to recover, filling console with '<vo_directx>Unable to lock surface, retrying'. You have to press Ctrl+C to quit. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
2006/11/10, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
Unfortunately Reimar's patch doesn't work: no segfault when screensaver is activated, but mplayer's audio output gets into a dead loop, playing a short piece again and again; when escaped from screensaver, mplayer's video output is unable to recover, filling console with '<vo_directx>Unable to lock surface, retrying'. You have to press Ctrl+C to quit.
Any better solution to this problem? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, On Friday 17 November 2006 14:01, Zuxy Meng wrote:
2006/11/10, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
Unfortunately Reimar's patch doesn't work: no segfault when screensaver is activated, but mplayer's audio output gets into a dead loop, playing a short piece again and again; when escaped from screensaver, mplayer's video output is unable to recover, filling console with '<vo_directx>Unable to lock surface, retrying'. You have to press Ctrl+C to quit.
Any better solution to this problem?
Not from my side. Please add the image == NULL checks to the other functions, too. Regards Sascha
Hi, 2006/11/18, Sascha Sommer <saschasommer@freenet.de>:
Hi,
Not from my side. Please add the image == NULL checks to the other functions, too.
Like this? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi On Saturday 18 November 2006 15:50, Zuxy Meng wrote:
Hi,
2006/11/18, Sascha Sommer <saschasommer@freenet.de>:
Hi,
Not from my side. Please add the image == NULL checks to the other functions, too.
Like this?
Yes. However I got yet another idea. When image is NULL we could also render to a malloced buffer. This would at least not disable direct rendering. What do you think? Regards Sascha
Hi, 2006/11/26, Sascha Sommer <saschasommer@freenet.de>:
Hi
Yes. However I got yet another idea. When image is NULL we could also render to a malloced buffer. This would at least not disable direct rendering. What do you think?
Direct rendering isn't disabled when image == NULL; get_image() will return VO_TRUE when !image in my patch. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, On Tuesday 28 November 2006 07:41, Zuxy Meng wrote:
Hi,
2006/11/26, Sascha Sommer <saschasommer@freenet.de>:
Hi
Yes. However I got yet another idea. When image is NULL we could also render to a malloced buffer. This would at least not disable direct rendering. What do you think?
Direct rendering isn't disabled when image == NULL; get_image() will return VO_TRUE when !image in my patch.
but then something is broken because the codec will render to a invalid buffer. Please try the attached patch, eh hack. Regards Sascha
Hi, 2006/12/2, Sascha Sommer <saschasommer@freenet.de>:
Hi,
but then something is broken because the codec will render to a invalid buffer.
How? "image" is a static variable and all external accesses to it have been guarded in my patch.
Please try the attached patch, eh hack.
The net effect is nearly identical to mine; no segfaults any more:-) However there are two small pitfalls: 1. If mplayer is the activated window before screensaving, then after recovered from screensaver mplayer will always be set on top regardless of previous settings. I guess you asked me about a line in my patch related to this:-) 2. If mplayer isn't the activated window before screensaving, then after recovered from screensaver mplayer will have a black window; you have to activate it to see video come back again. BTW: maybe the error message about rendering to a hidden surface can be shown only once instead of flushing the console. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, On Saturday 02 December 2006 16:58, Zuxy Meng wrote:
Hi,
2006/12/2, Sascha Sommer <saschasommer@freenet.de>:
Hi,
but then something is broken because the codec will render to a invalid buffer.
How? "image" is a static variable and all external accesses to it have been guarded in my patch.
get_image updates the pointers to the image in the mpi struct. The codecs will use this struct to render the image. They won't call any additional vo directx functions. With your patch they stay the same when Lock() failed. But the pointers are not valid after the directx Unlock() even if they happen to work.
Please try the attached patch, eh hack.
The net effect is nearly identical to mine; no segfaults any more:-) However there are two small pitfalls:
1. If mplayer is the activated window before screensaving, then after recovered from screensaver mplayer will always be set on top regardless of previous settings. I guess you asked me about a line in my patch related to this:-) 2. If mplayer isn't the activated window before screensaving, then after recovered from screensaver mplayer will have a black window; you have to activate it to see video come back again.
BTW: maybe the error message about rendering to a hidden surface can be shown only once instead of flushing the console.
I'm not sure if these issues are worth fixing. I cannot even reproduce the crash but if you come up with a clean solution for this feel free to update the patch. Regards Sascha
Hi, 2006/12/3, Sascha Sommer <saschasommer@freenet.de>:
Hi,
get_image updates the pointers to the image in the mpi struct. The codecs will use this struct to render the image. They won't call any additional vo directx functions. With your patch they stay the same when Lock() failed. But the pointers are not valid after the directx Unlock() even if they happen to work.
I'm not sure if these issues are worth fixing. I cannot even reproduce the crash but if you come up with a clean solution for this feel free to update the patch.
Hmm, seems not too hard a task to do. Maybe I can just merge parts of my patch to yours, replacing image with a dedicated static var. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, On Saturday 02 December 2006 17:42, Zuxy Meng wrote:
Hi,
2006/12/3, Sascha Sommer <saschasommer@freenet.de>:
Hi,
get_image updates the pointers to the image in the mpi struct. The codecs will use this struct to render the image. They won't call any additional vo directx functions. With your patch they stay the same when Lock() failed. But the pointers are not valid after the directx Unlock() even if they happen to work.
I'm not sure if these issues are worth fixing. I cannot even reproduce the crash but if you come up with a clean solution for this feel free to update the patch.
Hmm, seems not too hard a task to do. Maybe I can just merge parts of my patch to yours, replacing image with a dedicated static var.
Yes that should be possible. Regards Sascha
Hi, 2006/12/7, Sascha Sommer <saschasommer@freenet.de>:
Hi,
On Saturday 02 December 2006 17:42, Zuxy Meng wrote:
Hi,
2006/12/3, Sascha Sommer <saschasommer@freenet.de>:
Hi,
get_image updates the pointers to the image in the mpi struct. The codecs will use this struct to render the image. They won't call any additional vo directx functions. With your patch they stay the same when Lock() failed. But the pointers are not valid after the directx Unlock() even if they happen to work.
I'm not sure if these issues are worth fixing. I cannot even reproduce the crash but if you come up with a clean solution for this feel free to update the patch.
Hmm, seems not too hard a task to do. Maybe I can just merge parts of my patch to yours, replacing image with a dedicated static var.
Yes that should be possible.
Sorry for the late response...I was a bit too busy and nearly forgot about it. But could u pls review the attached patch? It combines good from both. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/10/23, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
2006/12/7, Sascha Sommer <saschasommer@freenet.de>:
Hi,
On Saturday 02 December 2006 17:42, Zuxy Meng wrote:
Hi,
2006/12/3, Sascha Sommer <saschasommer@freenet.de>:
Hi,
get_image updates the pointers to the image in the mpi struct. The codecs will use this struct to render the image. They won't call any additional vo directx functions. With your patch they stay the same when Lock() failed. But the pointers are not valid after the directx Unlock() even if they happen to work.
I'm not sure if these issues are worth fixing. I cannot even reproduce the crash but if you come up with a clean solution for this feel free to update the patch.
Hmm, seems not too hard a task to do. Maybe I can just merge parts of my patch to yours, replacing image with a dedicated static var.
Yes that should be possible.
Sorry for the late response...I was a bit too busy and nearly forgot about it. But could u pls review the attached patch? It combines good from both.
If no one objects I'll apply it this weekend. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hello, On Mon, Oct 23, 2006 at 01:05:48PM +0800, Zuxy Meng wrote:
Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window.
Can you test this? It is at least as ugly but more straightforward, if it works this while-loop should probably be a separate function and all lock calls replaced by it. Greetings, Reimar Döffinger
Hello, On Sun, Oct 29, 2006 at 10:19:07AM +0100, Reimar D?ffinger wrote:
On Mon, Oct 23, 2006 at 01:05:48PM +0800, Zuxy Meng wrote:
Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window.
Can you test this? It is at least as ugly but more straightforward, if it works this while-loop should probably be a separate function and all lock calls replaced by it.
Patch here *g* Greetings, Reimar Döffinger
Hi, On Sunday 29 October 2006 10:19, Reimar Döffinger wrote:
Hello,
On Sun, Oct 29, 2006 at 10:19:07AM +0100, Reimar D?ffinger wrote:
On Mon, Oct 23, 2006 at 01:05:48PM +0800, Zuxy Meng wrote:
Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window.
Can you test this? It is at least as ugly but more straightforward, if it works this while-loop should probably be a separate function and all lock calls replaced by it.
Patch here *g*
I do not like this patch. If I understand this correctly ( I'm not able to test at the moment ) locking will always fail when the screensave is on, no? With your patch vo directx will block for the whole time the screensaver is on. I do not see a reason why the audio shouldn't be playing in the background even though the screensaver is running, but then I thought we disable the screensaver somewhere in vo directx... Btw. in Zuxys patch @@ -679,7 +679,7 @@ dwUpdateFlags = DDOVER_SHOW | DDOVER_DDFX; /*if hardware can't do colorkeying set the window on top*/ if(capsDrv.dwCKeyCaps & DDCKEYCAPS_DESTOVERLAY) dwUpdateFlags |= DDOVER_KEYDESTOVERRIDE; - else vo_ontop = 1; + else if (image) vo_ontop = 1; } else { Why is this needed? Regards Sascha
Hello, On Sun, Oct 29, 2006 at 02:04:29PM +0100, Sascha Sommer wrote:
On Sunday 29 October 2006 10:19, Reimar Döffinger wrote:
On Sun, Oct 29, 2006 at 10:19:07AM +0100, Reimar D?ffinger wrote:
On Mon, Oct 23, 2006 at 01:05:48PM +0800, Zuxy Meng wrote:
Currently vo directx will crash with seg fault when a screensaver starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that when this happens, the last line of flip_page() will set image = NULL. This patch enables vo directx to survive a screensaver, a monitor off, a standby and a hibernation, either full screen or windowed, active or inactive. But there's still one situation that it can't handle: if mplayer starts to play a file while the screensaver is running, mplayer won't wake the computer up and once the screensaver exits, mplayer will have a black window.
Can you test this? It is at least as ugly but more straightforward, if it works this while-loop should probably be a separate function and all lock calls replaced by it.
Patch here *g*
I do not like this patch. If I understand this correctly ( I'm not able to test at the moment ) locking will always fail when the screensave is on, no? With your patch vo directx will block for the whole time the screensaver is on. I do not see a reason why the audio shouldn't be playing in the background even though the screensaver is running, but then I thought we disable the screensaver somewhere in vo directx...
Problem is, the other patch is most likely to not work either, e.g. it AFAICT does not fix get_image, which basically can not be fixed since failing will probably disable direct-rendering forever. It also seems to miss parts for draw_alpha and draw_slice and draw_frame. Greetings, Reimar Döffinger
Hi, 2006/10/29, Sascha Sommer <saschasommer@freenet.de>:
Hi,
On Sunday 29 October 2006 10:19, Reimar Döffinger wrote:
Hello,
Patch here *g*
I do not like this patch. If I understand this correctly ( I'm not able to test at the moment ) locking will always fail when the screensave is on, no? With your patch vo directx will block for the whole time the screensaver is on. I do not see a reason why the audio shouldn't be playing in the background even though the screensaver is running, but then I thought we disable the screensaver somewhere in vo directx...
Btw. in Zuxys patch
@@ -679,7 +679,7 @@ dwUpdateFlags = DDOVER_SHOW | DDOVER_DDFX; /*if hardware can't do colorkeying set the window on top*/ if(capsDrv.dwCKeyCaps & DDCKEYCAPS_DESTOVERLAY) dwUpdateFlags |= DDOVER_KEYDESTOVERRIDE; - else vo_ontop = 1; + else if (image) vo_ontop = 1; } else {
Why is this needed?
Without this line, when mplayer get recovered from screensaver, it'll always be on top regardless of previous settings. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
participants (3)
-
Reimar Döffinger -
Sascha Sommer -
Zuxy Meng