SDL_SetVideoMode hang

Hi,

I’m having an issue calling SDL_SetVideoMode right after SDL_Init - it will hang the process. If I Ctrl-C at this point the process will continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!

Please consider the environment before printing this email--------------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster (postmaster at hanoverdisplays.com) and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this e-mail and any attachment for viruses. We make no warranty as to absence of viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this email is of a personal nature, it must not be relied upon as expressing the views or opinions of the company.

SDL_SetVideoMode( x, y, depth, flags )On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne <josborne at hanoverdisplays.com wrote:

Hi,

I?m having an issue calling SDL_SetVideoMode right after SDL_Init - it will
hang the process. If I Ctrl-C at this point the process will continue and
work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster (
postmaster at hanoverdisplays.com) and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence of
viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing the
views or opinions of the company.
<#12be314fb992e08a_>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Hi,

I’m having an issue calling SDL_SetVideoMode right after SDL_Init - it will hang the process. If I Ctrl-C at this point the process will continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster (postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this e-mail and any attachment for viruses. We make no warranty as to absence of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this email is of a personal nature, it must not be relied upon as expressing the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Is m_pScreen a SDL_Surface* or just a SDL_Surface? (Should be the pointer
version)
Also, try compiling with the -g switch and run it through gdb.
Beyond that, I’d need to see more code to help, as it has to do something
with your other code.

Take care,
-AlexOn Mon, Oct 25, 2010 at 9:00 AM, Jamie Osborne <josborne at hanoverdisplays.com wrote:

Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne < josborne at hanoverdisplays.com> wrote:
Hi,

I?m having an issue calling SDL_SetVideoMode right after SDL_Init - it will
hang the process. If I Ctrl-C at this point the process will continue and
work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster (
postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence of
viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing the
views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster (
postmaster at hanoverdisplays.com) and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence of
viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing the
views or opinions of the company.
<#12be37a31aa8a958_>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, m_pScreen is a SDL_Surface*

I’m targeting the ARM so this is cross-compiled using codesourcerys toolchain.

The code for my test case (which is where I see the hang) is fairly simple:

main.cpp

int main(int argc, char* argv[])
{
Presentation* p = new Presentation(); //Presentation is used to display JPEGs
p->Initialise();

while (p->hasSlides())
{
p->DisplayNextSlide();
sleep(5);
}
return 0;
}

Presentation.cpp

Presentation::Initialise()
{
SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!m_pScreen)
{
//error handling…
}

SDL_ShowCursor(SDL_DISABLE);
initialised = true;
}

SDL_Surface* m_pImage;

Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling…
}

SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
}

As you can see, there’s really not much to it but it is definitely hanging at the point just after SDL_SetVideoMode is called.From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Alex Barry
Sent: 25 October 2010 14:17
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

Is m_pScreen a SDL_Surface* or just a SDL_Surface? (Should be the pointer version)
Also, try compiling with the -g switch and run it through gdb.
Beyond that, I’d need to see more code to help, as it has to do something with your other code.

Take care,
-Alex
On Mon, Oct 25, 2010 at 9:00 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Hi,

I’m having an issue calling SDL_SetVideoMode right after SDL_Init - it will hang the process. If I Ctrl-C at this point the process will continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster (postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this e-mail and any attachment for viruses. We make no warranty as to absence of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this email is of a personal nature, it must not be relied upon as expressing the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster (postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this e-mail and any attachment for viruses. We make no warranty as to absence of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this email is of a personal nature, it must not be relied upon as expressing the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Jamie,
Are you targeting the framebuffer with this? If so, I’ve seen issues
where the framebuffer gets locked in graphics mode, and then hangs when
SDL tries to issue the KDSETMODE ioctl. This can happen if your program
segfaults without running SDL_Exit, and then you try to re-run it.

To resolve this, I use the following during startup to ensure we’re in
KD_TEXT mode:
int fd;

 fd = open("/dev/tty0", O_RDONLY);
 if(fd < 0) {
     perr("Can't open console");
     return -1;
 }

 ioctl(fd, KDSETMODE, KD_TEXT);
 close(fd);

Regards,
AndreOn 26/10/10 02:34, Jamie Osborne wrote:

Yes, m_pScreen is a SDL_Surface*

I?m targeting the ARM so this is cross-compiled using codesourcerys
toolchain.

The code for my test case (which is where I see the hang) is fairly simple:

main.cpp

int main(int argc, char* argv[])
{
Presentation* p = new Presentation(); //Presentation is used to display
JPEGs
p->Initialise();

while (p->hasSlides())
{
p->DisplayNextSlide();
sleep(5);
}
return 0;
}

Presentation.cpp

Presentation::Initialise()
{
SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!m_pScreen)
{
//error handling…
}

SDL_ShowCursor(SDL_DISABLE);
initialised = true;
}

SDL_Surface* m_pImage;

Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling…
}

SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
}

As you can see, there’s really not much to it but it is definitely
hanging at the point just after SDL_SetVideoMode is called.

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 14:17
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

Is m_pScreen a SDL_Surface* or just a SDL_Surface? (Should be the
pointer version)
Also, try compiling with the -g switch and run it through gdb.
Beyond that, I’d need to see more code to help, as it has to do
something with your other code.

Take care,
-Alex
On Mon, Oct 25, 2010 at 9:00 AM, Jamie Osborne wrote:
Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne wrote:
Hi,

I?m having an issue calling SDL_SetVideoMode right after SDL_Init - it
will hang the process. If I Ctrl-C at this point the process will
continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com <mailto:postmaster at hanoverdisplays.com>)
and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.

<#>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
@Andre_Renaud PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934

Andre,
I am targeting the framebuffer yes. Thanks for your suggestion, unfortunately it did not work.

The hang doesn’t occur if I run the test program directly after a fresh boot of the system but it does hang on every subsequent run which does suggest something not being cleaned up correctly.

Regards,

Jamie>From my code below, I am running SDL_Quit in the Presentation destructor so ensuring it is closed correctly - are there any other steps I need to take to cleanup after displaying JPEGS using SDL?

----- Original Message -----
From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Andre Renaud
Sent: 25 October 2010 22:18
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_SetVideoMode hang

Hi Jamie,
Are you targeting the framebuffer with this? If so, I’ve seen issues
where the framebuffer gets locked in graphics mode, and then hangs when
SDL tries to issue the KDSETMODE ioctl. This can happen if your program
segfaults without running SDL_Exit, and then you try to re-run it.

To resolve this, I use the following during startup to ensure we’re in
KD_TEXT mode:
int fd;

 fd = open("/dev/tty0", O_RDONLY);
 if(fd < 0) {
     perr("Can't open console");
     return -1;
 }

 ioctl(fd, KDSETMODE, KD_TEXT);
 close(fd);

Regards,
Andre

On 26/10/10 02:34, Jamie Osborne wrote:

Yes, m_pScreen is a SDL_Surface*

I’m targeting the ARM so this is cross-compiled using codesourcerys
toolchain.

The code for my test case (which is where I see the hang) is fairly simple:

main.cpp

int main(int argc, char* argv[])
{
Presentation* p = new Presentation(); //Presentation is used to display
JPEGs
p->Initialise();

while (p->hasSlides())
{
p->DisplayNextSlide();
sleep(5);
}
return 0;
}

Presentation.cpp

Presentation::Initialise()
{
SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!m_pScreen)
{
//error handling…
}

SDL_ShowCursor(SDL_DISABLE);
initialised = true;
}

SDL_Surface* m_pImage;

Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling…
}

SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
}

As you can see, there’s really not much to it but it is definitely
hanging at the point just after SDL_SetVideoMode is called.

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 14:17
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

Is m_pScreen a SDL_Surface* or just a SDL_Surface? (Should be the
pointer version)
Also, try compiling with the -g switch and run it through gdb.
Beyond that, I’d need to see more code to help, as it has to do
something with your other code.

Take care,
-Alex
On Mon, Oct 25, 2010 at 9:00 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Hi,

I’m having an issue calling SDL_SetVideoMode right after SDL_Init - it
will hang the process. If I Ctrl-C at this point the process will
continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com <mailto:postmaster at hanoverdisplays.com>)
and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.

<#>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
andre at bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Update:

I’ve fixed the issue, I was simply not freeing the image surface after displaying which mean SDL_Quit wasn’t being called correctly!
Fixed code from example below:

SDL_Surface* m_pImage;

Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling…
}

SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
SDL_FreeSurface(m_pImage);
m_pImage = NULL;
}From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Jamie Osborne
Sent: 26 October 2010 10:11
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

Andre,
I am targeting the framebuffer yes. Thanks for your suggestion, unfortunately it did not work.

The hang doesn’t occur if I run the test program directly after a fresh boot of the system but it does hang on every subsequent run which does suggest something not being cleaned up correctly.

From my code below, I am running SDL_Quit in the Presentation destructor so ensuring it is closed correctly - are there any other steps I need to take to cleanup after displaying JPEGS using SDL?

Regards,

Jamie

----- Original Message -----
From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Andre Renaud
Sent: 25 October 2010 22:18
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_SetVideoMode hang

Hi Jamie,
Are you targeting the framebuffer with this? If so, I’ve seen issues
where the framebuffer gets locked in graphics mode, and then hangs when
SDL tries to issue the KDSETMODE ioctl. This can happen if your program
segfaults without running SDL_Exit, and then you try to re-run it.

To resolve this, I use the following during startup to ensure we’re in
KD_TEXT mode:
int fd;

 fd = open("/dev/tty0", O_RDONLY);
 if(fd < 0) {
     perr("Can't open console");
     return -1;
 }

 ioctl(fd, KDSETMODE, KD_TEXT);
 close(fd);

Regards,
Andre

On 26/10/10 02:34, Jamie Osborne wrote:

Yes, m_pScreen is a SDL_Surface*

I’m targeting the ARM so this is cross-compiled using codesourcerys
toolchain.

The code for my test case (which is where I see the hang) is fairly simple:

main.cpp

int main(int argc, char* argv[])
{
Presentation* p = new Presentation(); //Presentation is used to display
JPEGs
p->Initialise();

while (p->hasSlides())
{
p->DisplayNextSlide();
sleep(5);
}
return 0;
}

Presentation.cpp

Presentation::Initialise()
{
SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!m_pScreen)
{
//error handling…
}

SDL_ShowCursor(SDL_DISABLE);
initialised = true;
}

SDL_Surface* m_pImage;

Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling…
}

SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
}

As you can see, there’s really not much to it but it is definitely
hanging at the point just after SDL_SetVideoMode is called.

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 14:17
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

Is m_pScreen a SDL_Surface* or just a SDL_Surface? (Should be the
pointer version)
Also, try compiling with the -g switch and run it through gdb.
Beyond that, I’d need to see more code to help, as it has to do
something with your other code.

Take care,
-Alex
On Mon, Oct 25, 2010 at 9:00 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Yes, sorry, that was a typo in the email, this is the actual code:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16,SDL_DOUBLEBUF | SDL_FULLSCREEN);

From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
On Behalf Of Alex Barry
Sent: 25 October 2010 13:56
To: SDL Development List
Subject: Re: [SDL] SDL_SetVideoMode hang

SDL_SetVideoMode( x, y, depth, flags )
On Mon, Oct 25, 2010 at 7:10 AM, Jamie Osborne <@Jamie_Osborne> wrote:
Hi,

I’m having an issue calling SDL_SetVideoMode right after SDL_Init - it
will hang the process. If I Ctrl-C at this point the process will
continue and work as normal.

In my program Init function:

SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,SDL_DOUBLEBUF | SDL_FULLSCREEN);

. . .

Any help much appreciated!


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.

If you received this in error, please contact the sender or postmaster
(postmaster at hanoverdisplays.com <mailto:postmaster at hanoverdisplays.com>)
and delete the material from any computer.

Although we routinely screen for viruses, addressees should check this
e-mail and any attachment for viruses. We make no warranty as to absence
of viruses in this e-mail or any attachments.

Our Company’s email policy is to permit incidental personal use. If this
email is of a personal nature, it must not be relied upon as expressing
the views or opinions of the company.

<#>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
andre at bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Please consider the environment before printing this email


The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender or postmaster (postmaster at hanoverdisplays.com) and delete the material from any computer.
Although we routinely screen for viruses, addressees should check this e-mail and any attachment for viruses. We make no warranty as to absence of viruses in this e-mail or any attachments.
Our Company’s email policy is to permit incidental personal use. If this email is of a personal nature, it must not be relied upon as expressing the views or opinions of the company.