Sign in to follow this  
RunBerserk

Display resolution matters?

Recommended Posts

Hi,

how big is the possible performance difference if I'll take an 128 x 128,  /256px/512px ....display instead of 128x160/ 240 x 320/ (non power of 2)

and optimize all for an game? is it worth it to take 2^n display if possible?

 

the question is not for PC

more for things like arduino,esp8266,esp32,WiFiBoy...

tiny cpu, tiny ram, no gpu,no operating system,

Share this post


Link to post
Share on other sites

Your question is kinda hard to understand.

 

Are you asking if rendering to a screen with an aspect ratio of 1 (width = height) will be faster than rendering to one with a different aspect ratio (4/3, 16/9, etc)?

 

In an embedded system without GPU, the rendering responsibility will fall upon the CPU, so the only thing that should make a difference is the amount of pixels rendered, not the aspect ratio of the screen.

 

Or you mean that your game's supposed to support several different resolutions?

 

In that case, in my opinions, and given the scarce resources you have to work with, perhaps it would be better to develop a specific version of your game for each resolution you intend to support.

Not the entire game, but rather the rendering part, so that you don't have to spend extra CPU time converting from a generalized game resolution, to the actual, physical screen resolution, at run time (ie. Having your game output a "fixed" 256x256 resolution, and adjusting to each different screen resolution (320x240, 240x260, etc) at runtime).

 

Or is your question something else?

Share this post


Link to post
Share on other sites

Having a display width that is a power of 2 has the advantage of addressing individual pixels in an easier way. It's just some basic bit shifting and oring instead of relying on multiplication, for which there may not be hardware support in the microcontroller of choice and has to be emulated in software. This can be quite expensive. How expensive depends on what you are doing.

 

Also the devices you mention have vastly different specs. The Arduino in its most leveled up form seems to use an ATMega2560 with 8kbyte of SRAM. That exactly fits 256*256 monochrome pixels. While the ESP32 has a whopping 520kbyte, which is huge for a microcontroller. It would therefore be helpful if you were more specific.

 

And microcontrollers on the Arduino end of the performance spectrum would be maxed out just generating the video signal anyway, at least if you want the display to refresh at comfortable rate.

Share this post


Link to post
Share on other sites
You can do some low-level bit-fiddling/shift-arithmetic more readily if your width* is a power of two -- it doesn't matter so much what your height is.

Whether you gain a measurable advantage can depend on other things. For example, if you don't have a proper display controller or useful DMA and you're blasting pixels to the display in real-time, then your CPU probably doesn't have enough downtime to do what we'd think of as traditional software rasterization--the hard-real-time constraint becomes the limiting factor, along with any memory/device access latencies in the pixel-loop.

It can also be hard to make blanket statements about embedded devices. Some displays might have embedded buffers, some might have serial addressing, some might have planar video memory, some might have a line-stride that's different than the number of pixels wide it is, or you might be attempting to use an 8-bit microcontroller with a display that's wider than 256 pixels, or the display wants 9-bit color, or... You get the idea.

In general, powers of two are nice in some modestly useful ways, but opportunity and meaningful ability to leverage those nice things are pretty situational. For a computer a power-of-two number is kind of like a prime or square number is for a mathematician--its an ordinary number with an extra property that might sometimes give way to a helpful observation or shortcut, but more often than not, doesn't. If the inner kernel of what you're doing can exploit one such trick well you can see considerable speedups, or none at all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this