View Full Version : How much memory do I need for 1280x800-24 window surface?

02-21-2017, 12:37 PM
I'm getting a bad alloc error from eglCreateWindowSurface when I try to use a 1280x800 frame buffer. The same code works with the frame buffer set to 1024x768 - 16. meminfo seems to suggest that I have plenty of ram:
MemTotal: 2058728 kB
MemFree: 1652032 kB
MemAvailable: 1698644 kB

I'm maxed out on ram for my board, so I'm not sure what I can change to get the buffer size I need.

02-21-2017, 01:25 PM
What kind of device are you using? Embeded board? PC? Integraded GPU on board or CPU? Graphic card? Name? etc...

Because that makes a big difference here if you have a GPU with dedicated memory, a device that uses normal system ram but with a dedicated reserved area, or a device that can freely allocate from the normal system memory.

In the case of a graphic card you have to find out how much ram your GPU has.

With a integrated GPU you often can change the size of reserved system memory in the bios. So you may can set the value higher.

There may be other limitations. Already hat some older GPUs/drivers on notebooks that could not create surfaces greater then the screen size, found out because this would break playing videos with a higher resolution.

02-21-2017, 03:13 PM
1280x800 = 1,024,000
* 3 = 3,072,000 bytes

* 3 because 8 bits per byte.
24 / 8 = 3.

Now you need to know the size of your graphics memory.
But 3 meg is nothing, so your probably doing something wrong.

02-21-2017, 10:50 PM
Also, you might request a resolution not supported by your hardware.
Another remark: 1024*768 has 4/3 ratio whereas 1280*800 has a ratio of 1.6 (so it is not even 16/9).

02-22-2017, 01:07 AM
Typically there's no such thing as a 3 byte/24 bit format. Try creating it with 32 bits instead.