public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Purkait, Soham" <soham.purkait@intel.com>
To: Vidya Srinivas <vidya.srinivas@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: Re: tools/gputop: Fix zero output when stdout is not a terminal
Date: Thu, 9 Apr 2026 14:51:21 +0530	[thread overview]
Message-ID: <c0732adc-d6e2-46e2-bf65-2f51a8a75205@intel.com> (raw)
In-Reply-To: <20260407133940.134931-1-vidya.srinivas@intel.com>

Hi Vidya,

On 07-04-2026 19:09, Vidya Srinivas wrote:
> When gputop output is redirected to a file or run via adb shell

This issue has nothing to do with its output redirection to anywhere. So 
you can remove this statement.

> (e.g., on Android), update_console_size() calls ioctl(0, TIOCGWINSZ)
> on stdin which may not be a terminal. If stdin is a pipe or
> redirected, the ioctl returns -1 and con_w/con_h remain at their
> initial value of -1.
>
> This causes the main display loop to immediately break since
> lines >= con_h evaluates to true (0 >= -1), resulting in zero
> output being produced.
>
> Fix this by initializing con_w and con_h to default values of
> 80 and 50 respectively, so that when ioctl fails the display
> loop still produces output with sensible dimensions.
>
> v2: Try stdout, stdin, and stderr for terminal size before falling
>      back to defaults (Soham Purkait)

Please remove this as it is not implemented.

Thanks & Regards,
Soham

>
> v3: Initialize defaults in main() instead of adding fallback logic
>      in update_console_size() (Soham Purkait)
>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> ---
>   tools/gputop.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/gputop.c b/tools/gputop.c
> index 9b2e8cb6f..0ed5af456 100644
> --- a/tools/gputop.c
> +++ b/tools/gputop.c
> @@ -609,7 +609,7 @@ int main(int argc, char **argv)
>   	unsigned int period_us;
>   	struct igt_profiled_device *profiled_devices = NULL;
>   	struct igt_drm_clients *clients = NULL;
> -	int con_w = -1, con_h = -1;
> +	int con_w = 80, con_h = 50;
>   	int ret;
>   	long n;
>   

  reply	other threads:[~2026-04-09  9:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 13:45 [PATCH] tools/gputop: Fix zero output when stdout is not a terminal Vidya Srinivas
2026-04-02 14:56 ` Kamil Konieczny
2026-04-06  3:27   ` Srinivas, Vidya
2026-04-06  4:56 ` Purkait, Soham
2026-04-06  5:41   ` Srinivas, Vidya
2026-04-06 16:34     ` Purkait, Soham
2026-04-07 13:47       ` Srinivas, Vidya
2026-04-06  6:02 ` [PATCH] " Vidya Srinivas
2026-04-06  7:54 ` ✓ Xe.CI.BAT: success for tools/gputop: Fix zero output when stdout is not a terminal (rev2) Patchwork
2026-04-06  8:11 ` ✓ i915.CI.BAT: " Patchwork
2026-04-06 10:26 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-06 11:20 ` ✗ i915.CI.Full: " Patchwork
2026-04-07 13:39 ` [PATCH] tools/gputop: Fix zero output when stdout is not a terminal Vidya Srinivas
2026-04-09  9:21   ` Purkait, Soham [this message]
2026-04-09 13:23   ` Kamil Konieczny
2026-04-09 16:58     ` Srinivas, Vidya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0732adc-d6e2-46e2-bf65-2f51a8a75205@intel.com \
    --to=soham.purkait@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=vidya.srinivas@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox