[client] main: display error when the frame has been truncated

This commit is contained in:
Geoffrey McRae 2021-06-12 19:06:32 +10:00
parent d36c4f0e83
commit 9f25f7fced

View File

@ -34,6 +34,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include <stdatomic.h>
#include <linux/input.h>
@ -428,6 +429,23 @@ int main_frameThread(void * unused)
lgrFormat.stride = frame->stride;
lgrFormat.pitch = frame->pitch;
if (frame->height != frame->realHeight)
{
const float needed =
((frame->realHeight * frame->pitch * 2) / 1048576.0f) + 10.0f;
const int size = (int)powf(2.0f, ceilf(logf(needed) / logf(2.0f)));
DEBUG_BREAK();
DEBUG_WARN("IVSHMEM too small, screen truncated");
DEBUG_WARN("Recommend increase size to %d MiB", size);
DEBUG_BREAK();
app_alert(LG_ALERT_ERROR,
"IVSHMEM too small, screen truncated\n"
"Recommend increasing size to %d MiB",
size);
}
switch(frame->rotation)
{
case FRAME_ROT_0 : lgrFormat.rotate = LG_ROTATE_0 ; break;