Strange composite video behaviour


3 posts
by scottinthebooth » Tue Jun 11, 2013 1:39 am
All,

I've been using my Pi now for a couple months without any issues but this latest problem has me baffled. I'm trying to connect my Pi / Python / Pygame to an existing display using the composite out. When I start my program the display goes black (like its supposed to) but no graphics ever appear. I waited a good minute or so to see if it just needed to catch up. When I finally gave up on it I pressed CTRL + C and my graphics appeared! Anyone have thoughts as to why I have to "jump start" my program? I'm using the code from Adafruit to select the frame buffer

http://learn.adafruit.com/pi-video-outp ... ramebuffer

Code: Select all
        drivers = ['fbcon', 'directfb', 'svgalib']
        found = False
        for driver in drivers:
            # Make sure that SDL_VIDEODRIVER is set
            if not os.getenv('SDL_VIDEODRIVER'):
                os.putenv('SDL_VIDEODRIVER', driver)
            try:
                pygame.display.init()
            except pygame.error:
                print 'Driver: {0} failed.'.format(driver)
                continue
            found = True
            break


Thanks,
Scott
Posts: 1
Joined: Tue Jun 11, 2013 1:25 am
by selectnone » Thu Jul 04, 2013 10:19 pm
I'm looking for a solution to this too
Posts: 55
Joined: Fri Jun 22, 2012 10:16 pm
by selectnone » Thu Jul 04, 2013 11:03 pm
Ahah! I think I have a solution!

It looks like this script only works if the display is set to 640x480?
My framebuffer-draw scripts started working when I set these settings in my /boot/config.txt:

Code: Select all
framebuffer_width=640
framebuffer_width=480


I was previously using 320x240 to match the screen I'm using, and none of the pygame-framebuffer scripts I tried were working for me.

The comment for those lines in boot.txt says:
# uncomment to force a console size. By default it will be display's size minus
# overscan.


The framebuffer sizes are commented-out by default, so pygame would be dealing with some invalid resolution.

I bet some clever bod will be able to fix that script to work with other resolutions, now I've tracked it down.

I'd really like to get it working at 320x240 as it'll render faster, but this'll do for now.
Posts: 55
Joined: Fri Jun 22, 2012 10:16 pm