mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 18:06:13 +00:00
tests: use drm_open_any more
And fix it up to not leak open fds, which kills all the master only stuff.
This commit is contained in:
parent
a5e6897d10
commit
0732cc59ab
@ -171,6 +171,7 @@ int drm_get_card(int master)
|
|||||||
|
|
||||||
if (is_intel(fd) && master == 0) {
|
if (is_intel(fd) && master == 0) {
|
||||||
gem_quiescent_gpu(fd);
|
gem_quiescent_gpu(fd);
|
||||||
|
close(fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,29 +494,11 @@ static int run_test(void)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *modules[] = { "i915" };
|
drm_fd = drm_open_any();
|
||||||
unsigned int i;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(modules); i++) {
|
|
||||||
drm_fd = drmOpen(modules[i], NULL);
|
|
||||||
if (drm_fd < 0) {
|
|
||||||
printf("failed to load %s driver.\n", modules[i]);
|
|
||||||
goto out;
|
|
||||||
} else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(modules)) {
|
|
||||||
fprintf(stderr, "failed to load any modules, aborting.\n");
|
|
||||||
ret = -1;
|
|
||||||
goto out_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_test();
|
run_test();
|
||||||
|
|
||||||
out_close:
|
close(drm_fd);
|
||||||
drmClose(drm_fd);
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -803,8 +803,6 @@ static gboolean input_event(GIOChannel *source, GIOCondition condition,
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
const char *modules[] = { "i915" };
|
|
||||||
unsigned int i;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
GIOChannel *stdinchannel;
|
GIOChannel *stdinchannel;
|
||||||
GMainLoop *mainloop;
|
GMainLoop *mainloop;
|
||||||
@ -860,19 +858,7 @@ int main(int argc, char **argv)
|
|||||||
!test_preferred_mode)
|
!test_preferred_mode)
|
||||||
test_all_modes = 1;
|
test_all_modes = 1;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(modules); i++) {
|
drm_fd = drm_open_any();
|
||||||
drm_fd = drmOpen(modules[i], NULL);
|
|
||||||
if (drm_fd < 0)
|
|
||||||
printf("failed to load %s driver.\n", modules[i]);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(modules)) {
|
|
||||||
fprintf(stderr, "failed to load any modules, aborting.\n");
|
|
||||||
ret = -1;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
mainloop = g_main_loop_new(NULL, FALSE);
|
mainloop = g_main_loop_new(NULL, FALSE);
|
||||||
if (!mainloop) {
|
if (!mainloop) {
|
||||||
@ -918,7 +904,7 @@ out_hotplug:
|
|||||||
out_mainloop:
|
out_mainloop:
|
||||||
g_main_loop_unref(mainloop);
|
g_main_loop_unref(mainloop);
|
||||||
out_close:
|
out_close:
|
||||||
drmClose(drm_fd);
|
close(drm_fd);
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user