From 9f25f7fced5920e2925f8065b6677e0434ffc673 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 12 Jun 2021 19:06:32 +1000 Subject: [PATCH] [client] main: display error when the frame has been truncated --- client/src/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 0fd6d80f..671ede9a 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -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;