ezekiel181
Posts: 2
Joined: Thu Aug 16, 2012 11:44 am

SDL crashes from unsupported resolutions

Thu Aug 16, 2012 12:09 pm

I have a short program in c using SDL to display a test pattern. The idea is that the pi will, either through a delay or gpio push button, cycle through resolutions and display an image each time.
The drama is that if I try an unsupported resolution the screen blacks out and I have to ssh in to restart the pi. I`ve tried different combinations of software or hardware surface, double buffering etc.
I had hoped that listmodes would return the supported resolutions of the TV but it seems not.
Is there a way to catch it if the screen doesnt initialize properly? Or to query the TV what resolutions it will take?

I should point out it runs in console and is only connected via HDMI. Also I can post code if necessary.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: SDL crashes from unsupported resolutions

Thu Aug 16, 2012 8:33 pm

ezekiel181 wrote:I have a short program in c using SDL to display a test pattern. The idea is that the pi will, either through a delay or gpio push button, cycle through resolutions and display an image each time.
The drama is that if I try an unsupported resolution the screen blacks out and I have to ssh in to restart the pi. I`ve tried different combinations of software or hardware surface, double buffering etc.
I had hoped that listmodes would return the supported resolutions of the TV but it seems not.
Is there a way to catch it if the screen doesnt initialize properly? Or to query the TV what resolutions it will take?

I should point out it runs in console and is only connected via HDMI. Also I can post code if necessary.
I experienced lots and lots of this when getting my BASIC going on the console using SDL. In the end I resorted to probing for the modes using SDL_GetVideoInfo() and using that information.

See also this thread here: [url]http://www.raspberrypi.org/phpBB3/viewt ... =13789[url]

-Gordon
--
Gordons projects: https://projects.drogon.net/

ezekiel181
Posts: 2
Joined: Thu Aug 16, 2012 11:44 am

Re: SDL crashes from unsupported resolutions

Fri Aug 17, 2012 9:28 am

I`m already using your dumpvideoinfo function to check the current resolution :) your knowledge on the subject has been a great help already. Is there any way to find out what resolutions the TV supports? Trial and error would be ok if the video device wouldn`t crash every time it fails.

Our application is going to be as a signal generator for on site techs, so it`s constantly going to be used on different equipment where the device can`t be predicted.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5398
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: SDL crashes from unsupported resolutions

Fri Aug 17, 2012 9:36 am

ezekiel181 wrote:I`m already using your dumpvideoinfo function to check the current resolution :) your knowledge on the subject has been a great help already. Is there any way to find out what resolutions the TV supports? Trial and error would be ok if the video device wouldn`t crash every time it fails.

Our application is going to be as a signal generator for on site techs, so it`s constantly going to be used on different equipment where the device can`t be predicted.
Are you on latest firmware (e.g. with rpi-update). There was a hanging bug when changing framebuffer resolutions a while back.

Note that SDL will just change the framebuffer size/depth. It won't affect the HDMI mode. We should support any arbitrary size for framebuffer up to 1920x1200.
(671x1111 should be fine). It will just be resized to fit the currentl resolution of the display.

If you still have problems, then post (minimal) code that shows them.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: SDL crashes from unsupported resolutions

Fri Aug 17, 2012 9:37 am

ezekiel181 wrote:I`m already using your dumpvideoinfo function to check the current resolution :) your knowledge on the subject has been a great help already. Is there any way to find out what resolutions the TV supports? Trial and error would be ok if the video device wouldn`t crash every time it fails.

Our application is going to be as a signal generator for on site techs, so it`s constantly going to be used on different equipment where the device can`t be predicted.
Using that seems to work for me - my code to initialise and setup the screen is here:

http://unicorn.drogon.net/screenKeyboard.c

you should be able to pick out the bits from there - that (now) seems to have worked for me on most devices I've used - of-course there's the actual issue of overscan, etc. but that's behind the SDL.

One of the biggest things I found was NOT using double-buffering modes and making sure it's in 16bpp on a Pi...

-Gordon
--
Gordons projects: https://projects.drogon.net/

Return to “C/C++”