mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-23 18:06:18 +00:00
lib/drmtest: rip out drm_open_any_master
It's unused. Also most of our tests failed to ask for the right type of drm fd anyway. So it's imo better to just let them fall over when they don't get master but want it, like they already do today. This also allows us to garbage-collect the master parameter to drm_get_card and associated code. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
4ba1f2e104
commit
5951ffb6a0
@ -165,26 +165,6 @@ void gem_quiescent_gpu(int fd)
|
|||||||
gem_sync(fd, handle);
|
gem_sync(fd, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_master(int fd)
|
|
||||||
{
|
|
||||||
drm_client_t client;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Check that we're the only opener and authed. */
|
|
||||||
client.idx = 0;
|
|
||||||
ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
|
|
||||||
igt_assert (ret == 0);
|
|
||||||
if (!client.auth) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
client.idx = 1;
|
|
||||||
ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
|
|
||||||
if (ret != -1 || errno != EINVAL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_get_card() - get an intel card number for use in /dev or /sys
|
* drm_get_card() - get an intel card number for use in /dev or /sys
|
||||||
*
|
*
|
||||||
@ -192,7 +172,7 @@ static bool is_master(int fd)
|
|||||||
*
|
*
|
||||||
* returns -1 on error
|
* returns -1 on error
|
||||||
*/
|
*/
|
||||||
int drm_get_card(int master)
|
int drm_get_card(void)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
int i, fd;
|
int i, fd;
|
||||||
@ -209,17 +189,7 @@ int drm_get_card(int master)
|
|||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (is_intel(fd) && master == 0) {
|
if (is_intel(fd)) {
|
||||||
close(fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (master == 1 && is_master(fd)) {
|
|
||||||
close(fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (master == -1 && !is_master(fd)) {
|
|
||||||
close(fd);
|
close(fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -236,7 +206,7 @@ static int __drm_open_any(void)
|
|||||||
char *name;
|
char *name;
|
||||||
int ret, fd;
|
int ret, fd;
|
||||||
|
|
||||||
ret = asprintf(&name, "/dev/dri/card%d", drm_get_card(0));
|
ret = asprintf(&name, "/dev/dri/card%d", drm_get_card());
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -278,28 +248,6 @@ int drm_open_any(void)
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the first DRM device we can find where we end up being the master.
|
|
||||||
*/
|
|
||||||
int drm_open_any_master(void)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
int ret, fd;
|
|
||||||
|
|
||||||
ret = asprintf(&name, "/dev/dri/card%d", drm_get_card(1));
|
|
||||||
if (ret == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
fd = open(name, O_RDWR);
|
|
||||||
free(name);
|
|
||||||
if (fd == -1)
|
|
||||||
fprintf(stderr, "Couldn't find an un-controlled DRM device\n");
|
|
||||||
|
|
||||||
igt_assert(is_intel(fd));
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
|
void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_set_tiling st;
|
struct drm_i915_gem_set_tiling st;
|
||||||
|
@ -44,9 +44,8 @@
|
|||||||
drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
|
drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
|
||||||
const char *name, uint32_t handle);
|
const char *name, uint32_t handle);
|
||||||
|
|
||||||
int drm_get_card(int master);
|
int drm_get_card(void);
|
||||||
int drm_open_any(void);
|
int drm_open_any(void);
|
||||||
int drm_open_any_master(void);
|
|
||||||
|
|
||||||
void gem_quiescent_gpu(int fd);
|
void gem_quiescent_gpu(int fd);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ static int get_object_count(void)
|
|||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int ret, scanned;
|
int ret, scanned;
|
||||||
int device = drm_get_card(0);
|
int device = drm_get_card();
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
|
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
|
||||||
|
@ -648,7 +648,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
parse_options(argc, argv);
|
parse_options(argc, argv);
|
||||||
|
|
||||||
card_index = drm_get_card(0);
|
card_index = drm_get_card();
|
||||||
igt_assert(card_index != -1);
|
igt_assert(card_index != -1);
|
||||||
|
|
||||||
srandom(time(NULL));
|
srandom(time(NULL));
|
||||||
|
@ -570,7 +570,7 @@ static void eat_error_state(struct test_output *o)
|
|||||||
static const char data[] = "";
|
static const char data[] = "";
|
||||||
static char tmp[128];
|
static char tmp[128];
|
||||||
char fname[FILENAME_MAX];
|
char fname[FILENAME_MAX];
|
||||||
int card_index = drm_get_card(0);
|
int card_index = drm_get_card();
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ static void hang_gpu(struct test_output *o)
|
|||||||
static const char dfs_entry[] = "i915_ring_stop";
|
static const char dfs_entry[] = "i915_ring_stop";
|
||||||
static const char data[] = "0xf";
|
static const char data[] = "0xf";
|
||||||
char fname[FILENAME_MAX];
|
char fname[FILENAME_MAX];
|
||||||
int card_index = drm_get_card(0);
|
int card_index = drm_get_card();
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ static int get_object_count(void)
|
|||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int ret, scanned;
|
int ret, scanned;
|
||||||
int device = drm_get_card(0);
|
int device = drm_get_card();
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
|
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
|
||||||
|
@ -56,7 +56,7 @@ static unsigned int readit(const char *path)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const int device = drm_get_card(0);
|
const int device = drm_get_card();
|
||||||
char *path, *pathp, *pathpp;
|
char *path, *pathp, *pathpp;
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
unsigned int value1, value1p, value1pp, value2, value2p, value2pp;
|
unsigned int value1, value1p, value1pp, value2, value2p, value2pp;
|
||||||
|
@ -129,7 +129,7 @@ static void dumpit(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const int device = drm_get_card(0);
|
const int device = drm_get_card();
|
||||||
struct junk *junk = stuff;
|
struct junk *junk = stuff;
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ static int do_parse(int argc, char *argv[])
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const int device = drm_get_card(0);
|
const int device = drm_get_card();
|
||||||
char *path;
|
char *path;
|
||||||
unsigned int devid;
|
unsigned int devid;
|
||||||
int drm_fd, fd, ret;
|
int drm_fd, fd, ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user