lib: add a function to indicate activity

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2014-09-30 17:05:39 +01:00
parent c2d5519906
commit 6a8d33c2bb
5 changed files with 21 additions and 4 deletions

View File

@ -246,6 +246,21 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
(long long unsigned)i * 100 / total); (long long unsigned)i * 100 / total);
} }
/**
* igt_print_activity:
*
* Print a '.' to indicate activity. This is printed without a newline and
* only if output is to a terminal.
*/
void igt_print_activity(void)
{
if (!isatty(STDOUT_FILENO))
return;
igt_info(".");
fflush(stdout);
}
/* mappable aperture trasher helper */ /* mappable aperture trasher helper */
drm_intel_bo **trash_bos; drm_intel_bo **trash_bos;
int num_trash_bos; int num_trash_bos;

View File

@ -41,6 +41,7 @@ void igt_permute_array(void *array, unsigned size,
unsigned i, unsigned i,
unsigned j)); unsigned j));
void igt_progress(const char *header, uint64_t i, uint64_t total); void igt_progress(const char *header, uint64_t i, uint64_t total);
void igt_print_activity(void);
bool igt_check_boolean_env_var(const char *env_var, bool default_value); bool igt_check_boolean_env_var(const char *env_var, bool default_value);
bool igt_aub_dump_enabled(void); bool igt_aub_dump_enabled(void);

View File

@ -32,6 +32,7 @@
#include "igt_debugfs.h" #include "igt_debugfs.h"
#include "igt_kms.h" #include "igt_kms.h"
#include "intel_chipset.h" #include "intel_chipset.h"
#include "igt_aux.h"
#ifndef DRM_CAP_CURSOR_WIDTH #ifndef DRM_CAP_CURSOR_WIDTH
#define DRM_CAP_CURSOR_WIDTH 0x8 #define DRM_CAP_CURSOR_WIDTH 0x8
@ -105,7 +106,7 @@ static void do_single_test(data_t *data, int x, int y)
igt_plane_t *cursor; igt_plane_t *cursor;
cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb); cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
igt_info("."); fflush(stdout); igt_print_activity();
/* Hardware test */ /* Hardware test */
igt_paint_test_pattern(cr, data->screenw, data->screenh); igt_paint_test_pattern(cr, data->screenw, data->screenh);

View File

@ -33,6 +33,7 @@
#include "igt_kms.h" #include "igt_kms.h"
#include "ioctl_wrappers.h" #include "ioctl_wrappers.h"
#include "intel_chipset.h" #include "intel_chipset.h"
#include "igt_aux.h"
typedef struct { typedef struct {
int drm_fd; int drm_fd;
@ -173,8 +174,7 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
igt_plane_set_fb(primary, &fb[!(i&1)]); igt_plane_set_fb(primary, &fb[!(i&1)]);
igt_display_commit(display); igt_display_commit(display);
igt_info("."); igt_print_activity();
fflush(stdout);
} }
igt_plane_set_fb(primary, NULL); igt_plane_set_fb(primary, NULL);

View File

@ -885,7 +885,7 @@ static unsigned int run_test_step(struct test_output *o)
join_vblank_wait_thread(); join_vblank_wait_thread();
} }
igt_info("."); fflush(stdout); igt_print_activity();
if (do_flip && (o->flags & TEST_HANG)) { if (do_flip && (o->flags & TEST_HANG)) {
hang = hang_gpu(drm_fd); hang = hang_gpu(drm_fd);