Pygame Framerates and HWSURFACE?


Joined
Aug 20, 2010
Messages
179
Having seen bugs 122 and 121, and reading a few posts about Pygame's framerate, I was wondering if you guys could help me do some testing before my Open Pandora arrives? If I understand bug 122 correctly, the HWSURFACE option isn't available in Pygame because SDL doesn't support hardware surfaces. I want to find out how big of a deal that actually is.


Barbie's Seahorse Adventure seems to be an awesome game that doesn't actually require HWSURFACE because, in part, of their awesome redrawing algorithms. (After further review, my comment in bug 121 seems misplaced) How does this run on a Pandora?


This OpenGL Test, however, seems unrunnable when HWSURFACE or OPENGL is unavailable. Am I right?


Could folks compare framerates for different (especially scrolling) Pygames and let me know the results? I'd like to resolve the "Pygame is slow because of a lack of HWSURFACE support" or figure out how to render (*snicker*) that unnecessary. If BSA can do it as well as I think it does, then so can everybody else!
 
If anybody could give me the output of the following script on their Pandora, it'd be awesome, because that'd give me exactly what I needed to know:



Code:
import pygame

pygame.init()

print(pygame.display.Info())
 
If anybody could give me the output of the following script on their Pandora, it'd be awesome, because that'd give me exactly what I needed to know:

On my Pandora with HF4 installed, it says:



Code:
<VideoInfo(hw = 0, wm = 1,video_mem = 0

	     blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,

	     blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,

	     bitsize  = 16, bytesize = 2,

	     masks =  (63488, 2016, 31, 0),

	     shifts = (11, 5, 0, 0),

	     losses =  (3, 2, 3, 8),

	     current_w = 800, current_h = 480

>


HTH!
 
Yup, that's exactly what I was looking for. Thanks mash! Not the results I was hoping to see, but it's good to know for sure.
 
OH MY GOD, YES!


It would probably allow for hardware based support and OpenGL, which would massively increase framerates. However, it'd probably need some fair amount of tinkering (or at least need to be packaged up in the official firmware), so I'll try to hack on it this weekend.


It's also important to note that you can get along "just fine" without hardware support, but this should help lower the bar for awesome framerates with Pygame. I'll try to draw up a tutorial for this once I get everything worked out, mentally.
 
Last edited by a moderator:
I've tested it, and Notaz's updated SDL improves the framerates, but only moderately (BSA plays somewhat more smoothly). It seems we still lack hardware acceleration, which is where the largest speedups will come from.


Notaz's SDL doesn't change the output from Mash's data in post 3.
 
I've tested it, and Notaz's updated SDL improves the framerates, but only moderately (BSA plays somewhat more smoothly). It seems we still lack hardware acceleration, which is where the largest speedups will come from.


Notaz's SDL doesn't change the output from Mash's data in post 3.

Hi,


I am just wondering what happens when you set pygame to use HW_SURFACE explicitly?


Something like this should do the trick :



Code:
import pygame

display = pygame.display.set_mode(flags=(pygame.FULLSCREEN | pygame.HWSURFACE))

print(display)



Also the output of this command would be useful :



Code:
import pygame

print(pygame.display.Info())


Thanks,


Jonathan.
 
I am just wondering what happens when you set pygame to use HW_SURFACE explicitly?


Something like this should do the trick :



Code:
import pygame

display = pygame.display.set_mode(flags=(pygame.FULLSCREEN | pygame.HWSURFACE))

print(display)


No Python-Specialist here. I've just copied the lines above. On HF5, it gives:





Code:
Traceback (most recent call last):

  File "py1.py", line 2, in <module>

    display = pygame.display.set_mode(flags=(pygame.FULLSCREEN | pygame.HWSURFACE))

TypeError: set_mode() takes no keyword arguments





Also the output of this command would be useful :



Code:
import pygame

print(pygame.display.Info())


It says:



Code:
Traceback (most recent call last):

  File "py2.py", line 2, in <module>

    print(pygame.display.Info())

pygame.error: video system not initialized


python --version says: "Python 2.6.2".
 
Thanks for that, the lines didn't work.


Sorry my mistake, I should have tried the lines myself.


I made a quick script and attached it which should give the information I need if someone would be nice enough to run it using:



Code:
python testPygame.py

and post the output here.


There is also an interesting discussion about how to make pygame more efficient here on stackexchange which might be of interest to some developers.
 
Last edited by a moderator:
A very lazy testing script follows. This didn't change the display info on my laptop at all, nor my Pandora.

Code:
#! /usr/bin/python


# imports

from time import sleep

import sys

import pygame

pygame.init()


# no specials

info = pygame.display.Info()

res = (info.current_w, info.current_h)

print(info)


# HWSURFACE and FULLSCREEN

pygame.display.set_mode(res, pygame.HWSURFACE | pygame.FULLSCREEN)

info = pygame.display.Info()

print(info)


# HWSURFACE, FULLSCREEN, and OPENGL

pygame.display.set_mode(res, pygame.HWSURFACE | pygame.FULLSCREEN | pygame.OPENGL)

info = pygame.display.Info()

print(info)


# quit cleanly.

sys.exit()
 
A very lazy testing script follows. This didn't change the display info on my laptop at all, nor my Pandora.

Code:
#! /usr/bin/python


# imports

from time import sleep

import sys

import pygame

pygame.init()


# no specials

info = pygame.display.Info()

res = (info.current_w, info.current_h)

print(info)


# HWSURFACE and FULLSCREEN

pygame.display.set_mode(res, pygame.HWSURFACE | pygame.FULLSCREEN)

info = pygame.display.Info()

print(info)


# HWSURFACE, FULLSCREEN, and OPENGL

pygame.display.set_mode(res, pygame.HWSURFACE | pygame.FULLSCREEN | pygame.OPENGL)

info = pygame.display.Info()

print(info)


# quit cleanly.

sys.exit()
Yep, it seems to be quite difficult to get Hardware surfaces like this in pygame, maybe you need to compile it especially with support for HW surface and opengl?
 
Yep, it seems to be quite difficult to get Hardware surfaces like this in pygame, maybe you need to compile it especially with support for HW surface and opengl?

OpenGL support is, unfortunately, OpenGL, no OenGL-ES, so the OpenGL parts of Pygame would need to be rewritten. HWSURFACE support should be based on what SDL has access to, though I'm not completely sure on that.


Don't think you often recompile Python scripts though ;)
 
Yep, it seems to be quite difficult to get Hardware surfaces like this in pygame, maybe you need to compile it especially with support for HW surface and opengl?

OpenGL support is, unfortunately, OpenGL, no OenGL-ES, so the OpenGL parts of Pygame would need to be rewritten. HWSURFACE support should be based on what SDL has access to, though I'm not completely sure on that.


Don't think you often recompile Python scripts though ;)
Ha, of course I meant recompiling the SDL that pygame uses, though that doesn't seem like the problem, since SDL performs okay it seems.


I may have a look at this over the summer when I have a spare weekend, sounds like something that would be really useful to have for a lot of people.
 
Back
Top