mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-24 16:26:13 +00:00
tests/lib: make sure the GPU is idle at test start and exit
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64270 v2: - Make sure also that the GPU is idle at start and error exit of any test using drm_open_any(). (Daniel) v3: - actually call gem_quiescent_gpu() at exit Signed-off-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
a3b47dbe69
commit
1cb4f90946
@ -228,7 +228,7 @@ int drm_get_card(int master)
|
||||
}
|
||||
|
||||
/** Open the first DRM device we can find, searching up to 16 device nodes */
|
||||
int drm_open_any(void)
|
||||
static int __drm_open_any(void)
|
||||
{
|
||||
char *name;
|
||||
int ret, fd;
|
||||
@ -248,6 +248,31 @@ int drm_open_any(void)
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void quiescent_gpu_at_exit(int sig)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = __drm_open_any();
|
||||
if (fd >= 0) {
|
||||
gem_quiescent_gpu(fd);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
int drm_open_any(void)
|
||||
{
|
||||
static int open_count;
|
||||
int fd = __drm_open_any();
|
||||
|
||||
if (fd < 0 || __sync_fetch_and_add(&open_count, 1))
|
||||
return fd;
|
||||
|
||||
gem_quiescent_gpu(fd);
|
||||
drmtest_install_exit_handler(quiescent_gpu_at_exit);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the first DRM device we can find where we end up being the master.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user