WayneKeenan / python-vrzero

VR on the Pi, in Python
86 stars 20 forks source link

setting display_rotate in config.txt impacts performance #5

Open WayneKeenan opened 7 years ago

WayneKeenan commented 7 years ago

It was reported that the HDMI rotation in config.txt has a performance impact. Proposed solution is to instead specify the rotation at the OpenGL ES level. Either in the Pi3D StereoCamera setup, or, if that API doesn't quite work as expected then perform the rotation 'manually' in the barrel and a copy of uv_flat GL ES shaders.

WayneKeenan commented 6 years ago

There is ~20% frame rate improvement on the Abbey demo when the display_rotate in config.txt isn't being used.

Still need to make the downstream OpenGL ES rendering changes thought.

WayneKeenan commented 3 years ago

this isn't needed on a Pi4 and as Pi4 is now the minimum supported hardware I'm closing this.

WayneKeenan commented 3 years ago

This isn't needed on a Pi4 for PSVR, but rotation is still needed for DK2 (see#14)

69K-ram commented 3 years ago

Is it possible the rotation slowdown for 90 and 270 is because the frame buffer is stored vertically in RAM but then is read horizontally? Sorry if I didn’t explain clearly

Edit: from the Lodev raycasting page: Raycasting works with vertical stripes, but the screen buffer in memory is laid out with horizontal scanlines. So drawing vertical stripes is bad for memory locality for caching (it is in fact a worst case scenario), and the loss of good caching may hurt the speed more than some of the 3D computations on modern machines. It may be possible to program this with better caching behavior (e.g. processing multiple stripes at once, using a cache-oblivious transpose algorithm, or having a 90 degree rotated raycaster), but for simplicity the rest of this tutorial ignores this caching issue.