mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 23:06:29 +00:00
tests/gem_exec_nop: silence the compiler by failing on error
gem_exec_nop.c: In function ‘exec’: gem_exec_nop.c:101:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] Propagate the failure and exit(1).
This commit is contained in:
parent
ceb9f7d934
commit
2a292188e7
@ -94,11 +94,11 @@ static double elapsed(const struct timeval *start,
|
|||||||
return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop;
|
return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exec(int fd, uint32_t handle, int loops)
|
static int exec(int fd, uint32_t handle, int loops)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_execbuffer2 execbuf;
|
struct drm_i915_gem_execbuffer2 execbuf;
|
||||||
struct drm_i915_gem_exec_object2 exec[1];
|
struct drm_i915_gem_exec_object2 exec[1];
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
exec[0].handle = handle;
|
exec[0].handle = handle;
|
||||||
exec[0].relocation_count = 0;
|
exec[0].relocation_count = 0;
|
||||||
@ -121,12 +121,14 @@ static void exec(int fd, uint32_t handle, int loops)
|
|||||||
execbuf.rsvd1 = 0;
|
execbuf.rsvd1 = 0;
|
||||||
execbuf.rsvd2 = 0;
|
execbuf.rsvd2 = 0;
|
||||||
|
|
||||||
while (loops--) {
|
while (loops-- && ret == 0) {
|
||||||
ret = drmIoctl(fd,
|
ret = drmIoctl(fd,
|
||||||
DRM_IOCTL_I915_GEM_EXECBUFFER2,
|
DRM_IOCTL_I915_GEM_EXECBUFFER2,
|
||||||
&execbuf);
|
&execbuf);
|
||||||
}
|
}
|
||||||
gem_sync(fd, handle);
|
gem_sync(fd, handle);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -145,7 +147,8 @@ int main(int argc, char **argv)
|
|||||||
struct timeval start, end;
|
struct timeval start, end;
|
||||||
|
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
exec(fd, handle, count);
|
if (exec(fd, handle, count))
|
||||||
|
exit(1);
|
||||||
gettimeofday(&end, NULL);
|
gettimeofday(&end, NULL);
|
||||||
printf("Time to exec x %d: %7.3fµs\n",
|
printf("Time to exec x %d: %7.3fµs\n",
|
||||||
count, elapsed(&start, &end, count));
|
count, elapsed(&start, &end, count));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user