mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	tests/gem_seqno_wrap: skip if debugfs entry is not there
Return error code 77 to skip test if debugfs entry is not available. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59116 Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
		
							parent
							
								
									2d0a8e8545
								
							
						
					
					
						commit
						c612481a19
					
				@ -49,6 +49,7 @@
 | 
			
		||||
#include "rendercopy.h"
 | 
			
		||||
 | 
			
		||||
static int devid;
 | 
			
		||||
static int card_index = 0;
 | 
			
		||||
static uint32_t last_seqno = 0;
 | 
			
		||||
 | 
			
		||||
static struct intel_batchbuffer *batch_blt;
 | 
			
		||||
@ -355,7 +356,27 @@ static int run_cmd(char *s)
 | 
			
		||||
	return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *debug_fs_entry = "/sys/kernel/debug/dri/0/i915_next_seqno";
 | 
			
		||||
static const char *dfs_base = "/sys/kernel/debug/dri";
 | 
			
		||||
static const char *dfs_entry = "i915_next_seqno";
 | 
			
		||||
 | 
			
		||||
static int dfs_open(int mode)
 | 
			
		||||
{
 | 
			
		||||
	char fname[FILENAME_MAX];
 | 
			
		||||
	int fh;
 | 
			
		||||
 | 
			
		||||
	snprintf(fname, FILENAME_MAX, "%s/%i/%s",
 | 
			
		||||
		 dfs_base, card_index, dfs_entry);
 | 
			
		||||
 | 
			
		||||
	fh = open(fname, mode);
 | 
			
		||||
	if (fh == -1) {
 | 
			
		||||
		fprintf(stderr,
 | 
			
		||||
			"error %d opening '%s/%d/%s'. too old kernel?\n",
 | 
			
		||||
			errno, dfs_base, card_index, dfs_entry);
 | 
			
		||||
		exit(77);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return fh;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int __read_seqno(uint32_t *seqno)
 | 
			
		||||
{
 | 
			
		||||
@ -365,12 +386,7 @@ static int __read_seqno(uint32_t *seqno)
 | 
			
		||||
	char *p;
 | 
			
		||||
	unsigned long int tmp;
 | 
			
		||||
 | 
			
		||||
	fh = open(debug_fs_entry, O_RDWR);
 | 
			
		||||
	if (fh == -1) {
 | 
			
		||||
		perror("open");
 | 
			
		||||
		fprintf(stderr, "no %s found, too old kernel?\n", debug_fs_entry);
 | 
			
		||||
		return -errno;
 | 
			
		||||
	}
 | 
			
		||||
	fh = dfs_open(O_RDONLY);
 | 
			
		||||
 | 
			
		||||
	r = read(fh, buf, sizeof(buf) - 1);
 | 
			
		||||
	close(fh);
 | 
			
		||||
@ -385,8 +401,9 @@ static int __read_seqno(uint32_t *seqno)
 | 
			
		||||
	if (!p)
 | 
			
		||||
		p = buf;
 | 
			
		||||
 | 
			
		||||
	errno = 0;
 | 
			
		||||
	tmp = strtoul(p, NULL, 0);
 | 
			
		||||
	if (tmp == ULONG_MAX) {
 | 
			
		||||
	if (tmp == ULONG_MAX && errno) {
 | 
			
		||||
		perror("strtoul");
 | 
			
		||||
		return -errno;
 | 
			
		||||
	}
 | 
			
		||||
@ -425,12 +442,7 @@ static int write_seqno(uint32_t seqno)
 | 
			
		||||
	if (options.dontwrap)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	fh = open(debug_fs_entry, O_RDWR);
 | 
			
		||||
	if (fh == -1) {
 | 
			
		||||
		perror("open");
 | 
			
		||||
		return -errno;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fh = dfs_open(O_RDWR);
 | 
			
		||||
	assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0);
 | 
			
		||||
 | 
			
		||||
	r = write(fh, buf, strnlen(buf, sizeof(buf)));
 | 
			
		||||
@ -627,6 +639,9 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	parse_options(argc, argv);
 | 
			
		||||
 | 
			
		||||
	card_index = drm_get_card(0);
 | 
			
		||||
	assert(card_index != -1);
 | 
			
		||||
 | 
			
		||||
	srandom(time(NULL));
 | 
			
		||||
 | 
			
		||||
	while(options.rounds == 0 || wcount < options.rounds) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user