From: Tvrtko Ursulin <[email protected]>

TIOCGWINSZ returns zero columns and rows on serial so lets assume 80x24.

Signed-off-by: Tvrtko Ursulin <[email protected]>
---
 tools/intel_gpu_top.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index d1149eb8e14d..72ad7cbe9a8c 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1640,6 +1640,11 @@ int main(int argc, char **argv)
                } else if (ioctl(0, TIOCGWINSZ, &ws) != -1) {
                        con_w = ws.ws_col;
                        con_h = ws.ws_row;
+                       if (con_w == 0 && con_h == 0) {
+                               /* Serial console. */
+                               con_w = 80;
+                               con_h = 24;
+                       }
                }
 
                pmu_sample(engines);
-- 
2.25.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to