How much memory do I need for 1280x800-24 window surface?

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.

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.

Well,
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.

Also, you might request a resolution not supported by your hardware.
Another remark: 1024768 has 4/3 ratio whereas 1280800 has a ratio of 1.6 (so it is not even 16/9).

Typically there’s no such thing as a 3 byte/24 bit format. Try creating it with 32 bits instead.