* [PATCH igt] tools: Stop opening the driver just to find the debugfs
@ 2017-11-20 16:01 Chris Wilson
2017-11-20 16:23 ` ✓ Fi.CI.BAT: success for " Patchwork
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-11-20 16:01 UTC (permalink / raw)
To: intel-gfx
Since the tools want to work without the module loaded, remove the
assumption that we want to load the driver to find debugfs.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_debugfs.c | 15 ++++++---------
tools/intel_display_poller.c | 8 +-------
tools/intel_forcewaked.c | 9 ++-------
tools/intel_gpu_top.c | 7 +------
tools/intel_guc_logger.c | 10 +++-------
tools/intel_infoframes.c | 7 +------
tools/intel_panel_fitter.c | 8 ++------
tools/intel_reg.c | 10 +++-------
tools/intel_watermark.c | 20 +++++++-------------
9 files changed, 26 insertions(+), 68 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 40cfd87a..658126e3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -150,18 +150,15 @@ char *igt_debugfs_path(int device, char *path, int pathlen)
const char *debugfs_root;
int idx;
- if (fstat(device, &st)) {
- igt_debug("Couldn't stat FD for DRM device: %s\n", strerror(errno));
- return NULL;
- }
+ debugfs_root = igt_debugfs_mount();
+ igt_assert(debugfs_root);
- if (!S_ISCHR(st.st_mode)) {
+ memset(&st, 0, sizeof(st));
+ if (fstat(device, &st))
+ igt_debug("Couldn't stat FD for DRM device: %s\n", strerror(errno));
+ else if (!S_ISCHR(st.st_mode))
igt_debug("FD for DRM device not a char device!\n");
- return NULL;
- }
- debugfs_root = igt_debugfs_mount();
- igt_assert(debugfs_root);
idx = minor(st.st_rdev);
snprintf(path, pathlen, "%s/dri/%d/name", debugfs_root, idx);
diff --git a/tools/intel_display_poller.c b/tools/intel_display_poller.c
index 828ca52b..a26e2ecf 100644
--- a/tools/intel_display_poller.c
+++ b/tools/intel_display_poller.c
@@ -965,7 +965,6 @@ int main(int argc, char *argv[])
int pipe = 0, bit = 0, target_scanline = 0, target_fuzz = 1;
bool test_pixelcount = false;
uint32_t devid;
- int drm_fd;
uint32_t min[2*128] = {};
uint32_t max[2*128] = {};
uint32_t a, b;
@@ -1187,10 +1186,7 @@ int main(int argc, char *argv[])
break;
}
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
printf("%s?\n", test_name(test, pipe, bit, test_pixelcount));
@@ -1267,8 +1263,6 @@ int main(int argc, char *argv[])
intel_register_access_fini();
- close(drm_fd);
-
if (quit)
return 0;
diff --git a/tools/intel_forcewaked.c b/tools/intel_forcewaked.c
index aa8e3f8b..02fbf888 100644
--- a/tools/intel_forcewaked.c
+++ b/tools/intel_forcewaked.c
@@ -64,7 +64,6 @@ is_alive(void) {
int main(int argc, char *argv[])
{
- int drm_fd;
int ret;
if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) {
@@ -81,10 +80,7 @@ int main(int argc, char *argv[])
INFO_PRINT("started daemon");
}
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
- ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd);
+ ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
if (ret) {
INFO_PRINT("Couldn't init register access\n");
exit(1);
@@ -95,14 +91,13 @@ int main(int argc, char *argv[])
if (!is_alive()) {
INFO_PRINT("gpu reset? restarting daemon\n");
intel_register_access_fini();
- ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd);
+ ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
if (ret)
INFO_PRINT("Reg access init fail\n");
}
sleep(1);
}
intel_register_access_fini();
- close(drm_fd);
INFO_PRINT("Forcewake unlock\n");
if (daemonized) {
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 7454de87..83cf53ea 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -409,7 +409,6 @@ usage(const char *appname)
int main(int argc, char **argv)
{
uint32_t devid;
- int drm_fd;
struct pci_device *pci_dev;
struct ring render_ring = {
.name = "render",
@@ -510,11 +509,8 @@ int main(int argc, char **argv)
top_bits_sorted[i] = &top_bits[i];
}
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver(DRIVER_INTEL);
-
/* Grab access to the registers */
- intel_register_access_init(pci_dev, 0, drm_fd);
+ intel_register_access_init(pci_dev, 0, -1);
ring_init(&render_ring);
if (IS_GEN4(devid) || IS_GEN5(devid))
@@ -717,6 +713,5 @@ int main(int argc, char **argv)
fclose(output);
intel_register_access_fini();
- close(drm_fd);
return 0;
}
diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c
index 7c6115a6..031fd84d 100644
--- a/tools/intel_guc_logger.c
+++ b/tools/intel_guc_logger.c
@@ -46,7 +46,7 @@ int verbosity_level = 3; /* by default capture logs at max verbosity */
uint32_t produced, consumed;
uint64_t total_bytes_written;
int num_buffers = NUM_SUBBUFS;
-int relay_fd, drm_fd, outfile_fd = -1;
+int relay_fd, outfile_fd = -1;
uint32_t test_duration, max_filesize;
pthread_cond_t underflow_cond, overflow_cond;
bool stop_logging, discard_oldlogs, capturing_stopped;
@@ -58,7 +58,7 @@ static void guc_log_control(bool enable_logging)
uint64_t val;
int ret;
- control_fd = igt_debugfs_open(drm_fd, CONTROL_FILE_NAME, O_WRONLY);
+ control_fd = igt_debugfs_open(-1, CONTROL_FILE_NAME, O_WRONLY);
igt_assert_f(control_fd >= 0, "couldn't open the guc log control file\n");
val = enable_logging ? ((verbosity_level << 4) | 0x1) : 0;
@@ -227,7 +227,7 @@ static void init_flusher_thread(void)
static void open_relay_file(void)
{
- relay_fd = igt_debugfs_open(drm_fd, RELAY_FILE_NAME, O_RDONLY);
+ relay_fd = igt_debugfs_open(-1, RELAY_FILE_NAME, O_RDONLY);
igt_assert_f(relay_fd >= 0, "couldn't open the guc log file\n");
/* Purge the old/boot-time logs from the relay buffer.
@@ -373,9 +373,6 @@ int main(int argc, char **argv)
process_command_line(argc, argv);
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
init_main_thread();
/* Use a separate thread for flushing the logs to a file on disk.
@@ -436,6 +433,5 @@ int main(int argc, char **argv)
free(read_buffer);
close(relay_fd);
close(outfile_fd);
- close(drm_fd);
igt_exit();
}
diff --git a/tools/intel_infoframes.c b/tools/intel_infoframes.c
index 813430c9..2ef5d4fd 100644
--- a/tools/intel_infoframes.c
+++ b/tools/intel_infoframes.c
@@ -1081,7 +1081,6 @@ printf("Options:\n"
int main(int argc, char *argv[])
{
int opt;
- int drm_fd;
int ret = 0;
Transcoder transcoder = TRANSC_INVALID;
DipType dip = DIP_INVALID;
@@ -1108,11 +1107,8 @@ int main(int argc, char *argv[])
printf("WARNING: This is just a debugging tool! Don't expect it to work"
" perfectly: the Kernel might undo our changes.\n");
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
pci_dev = intel_get_pci_device();
- intel_register_access_init(pci_dev, 0, drm_fd);
+ intel_register_access_init(pci_dev, 0, -1);
intel_check_pch();
if (IS_GEN4(pci_dev->device_id))
@@ -1261,6 +1257,5 @@ int main(int argc, char *argv[])
out:
intel_register_access_fini();
- close(drm_fd);
return ret;
}
diff --git a/tools/intel_panel_fitter.c b/tools/intel_panel_fitter.c
index 48b2fd89..137ef61a 100644
--- a/tools/intel_panel_fitter.c
+++ b/tools/intel_panel_fitter.c
@@ -266,7 +266,7 @@ static void print_usage(void)
int main (int argc, char *argv[])
{
- int opt, drm_fd;
+ int opt;
int ret = 0;
char intel_pipe = '\0';
int x = 0, y = 0;
@@ -279,11 +279,8 @@ int main (int argc, char *argv[])
"with overscan compensation properties: it is just a temporary "
"solution that may or may not work. Use it at your own risk.\n");
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
pci_dev = intel_get_pci_device();
- intel_register_access_init(pci_dev, 0, drm_fd);
+ intel_register_access_init(pci_dev, 0, -1);
devid = pci_dev->device_id;
if (!HAS_PCH_SPLIT(devid)) {
@@ -346,6 +343,5 @@ int main (int argc, char *argv[])
out:
intel_register_access_fini();
- close(drm_fd);
return ret;
}
diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index d6f81840..00d2a4a1 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -58,7 +58,6 @@ struct config {
struct pci_device *pci_dev;
char *mmiofile;
uint32_t devid;
- int drm_fd;
/* read: number of registers to read */
uint32_t count;
@@ -411,7 +410,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
if (config->mmiofile)
intel_mmio_use_dump_file(config->mmiofile);
else
- intel_register_access_init(config->pci_dev, 0, config->drm_fd);
+ intel_register_access_init(config->pci_dev, 0, -1);
for (i = 1; i < argc; i++) {
struct reg reg;
@@ -441,7 +440,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
return EXIT_FAILURE;
}
- intel_register_access_init(config->pci_dev, 0, config->drm_fd);
+ intel_register_access_init(config->pci_dev, 0, -1);
for (i = 1; i < argc; i += 2) {
struct reg reg;
@@ -479,7 +478,7 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
if (config->mmiofile)
intel_mmio_use_dump_file(config->mmiofile);
else
- intel_register_access_init(config->pci_dev, 0, config->drm_fd);
+ intel_register_access_init(config->pci_dev, 0, -1);
for (i = 0; i < config->regcount; i++) {
reg = &config->regs[i];
@@ -879,9 +878,6 @@ int main(int argc, char *argv[])
config.devid = config.pci_dev->device_id;
}
- /* Just to make sure we open the right debugfs files */
- config.drm_fd = __drm_open_driver(DRIVER_INTEL);
-
if (read_reg_spec(&config) < 0) {
return EXIT_FAILURE;
}
diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c
index d8c78480..de0b0831 100644
--- a/tools/intel_watermark.c
+++ b/tools/intel_watermark.c
@@ -34,7 +34,6 @@
static uint32_t display_base;
static uint32_t devid;
-static int drm_fd;
static uint32_t read_reg(uint32_t addr)
{
@@ -143,7 +142,7 @@ static void ilk_wm_dump(void)
int num_pipes = is_gen7_plus(devid) ? 3 : 2;
struct ilk_wm wm = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
for (i = 0; i < num_pipes; i++) {
dspcntr[i] = read_reg(0x70180 + i * 0x1000);
@@ -291,7 +290,7 @@ static void vlv_wm_dump(void)
uint32_t dsp_ss_pm, ddr_setup2;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dsparb = read_reg(0x70030);
dsparb2 = read_reg(0x70060);
@@ -507,7 +506,7 @@ static void g4x_wm_dump(void)
uint32_t mi_arb_state;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dspacntr = read_reg(0x70180);
dspbcntr = read_reg(0x71180);
@@ -593,7 +592,7 @@ static void gen4_wm_dump(void)
uint32_t mi_arb_state;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dsparb = read_reg(0x70030);
fw1 = read_reg(0x70034);
@@ -664,7 +663,7 @@ static void pnv_wm_dump(void)
uint32_t cbr;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dsparb = read_reg(0x70030);
fw1 = read_reg(0x70034);
@@ -754,7 +753,7 @@ static void gen3_wm_dump(void)
uint32_t mi_arb_state;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dsparb = read_reg(0x70030);
instpm = read_reg(0x20c0);
@@ -823,7 +822,7 @@ static void gen2_wm_dump(void)
uint32_t mi_state;
struct gmch_wm wms[MAX_PLANE] = {};
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(intel_get_pci_device(), 0, -1);
dsparb = read_reg(0x70030);
mem_mode = read_reg(0x20cc);
@@ -900,9 +899,6 @@ int main(int argc, char *argv[])
{
devid = intel_get_pci_device()->device_id;
- /* Just to make sure we open the right debugfs files */
- drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) {
display_base = 0x180000;
vlv_wm_dump();
@@ -923,7 +919,5 @@ int main(int argc, char *argv[])
return 1;
}
- close(drm_fd);
-
return 0;
}
--
2.15.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* ✓ Fi.CI.BAT: success for tools: Stop opening the driver just to find the debugfs
2017-11-20 16:01 [PATCH igt] tools: Stop opening the driver just to find the debugfs Chris Wilson
@ 2017-11-20 16:23 ` Patchwork
2017-11-20 17:13 ` [PATCH igt] " Ville Syrjälä
2017-11-20 18:22 ` ✓ Fi.CI.IGT: success for " Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-11-20 16:23 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: tools: Stop opening the driver just to find the debugfs
URL : https://patchwork.freedesktop.org/series/34107/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
9fb5344bab2540e3d12a7d3a94c2a3801a6fec36 tools/error_decode: Print ASCII user buffers
with latest DRM-Tip kernel build CI_DRM_3363
afdf2daaf511 drm-tip: 2017y-11m-20d-15h-10m-35s UTC integration manifest
No testlist changes.
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-gdg-551) fdo#102618
fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:444s
fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:386s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:537s
fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:280s
fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:511s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:512s
fi-byt-j1900 total:289 pass:254 dwarn:0 dfail:0 fail:0 skip:35 time:507s
fi-byt-n2820 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:494s
fi-cfl-s2 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:612s
fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:433s
fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:269s
fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:544s
fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:432s
fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:439s
fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:433s
fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:481s
fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:465s
fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:486s
fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:536s
fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:478s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:541s
fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:586s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:460s
fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:547s
fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:564s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:520s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:500s
fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:463s
fi-snb-2520m total:246 pass:212 dwarn:0 dfail:0 fail:0 skip:33
fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:435s
Blacklisted hosts:
fi-glk-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:497s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_513/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH igt] tools: Stop opening the driver just to find the debugfs
2017-11-20 16:01 [PATCH igt] tools: Stop opening the driver just to find the debugfs Chris Wilson
2017-11-20 16:23 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-11-20 17:13 ` Ville Syrjälä
2017-11-21 12:01 ` Chris Wilson
2017-11-20 18:22 ` ✓ Fi.CI.IGT: success for " Patchwork
2 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2017-11-20 17:13 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
On Mon, Nov 20, 2017 at 04:01:24PM +0000, Chris Wilson wrote:
> Since the tools want to work without the module loaded, remove the
> assumption that we want to load the driver to find debugfs.
So looking at the history it was actually Tomeu that caused this
problem originally. That added the bogus master requirement
as well. So now I can forget my patch to drop the master requirement
from intel_watermark as well. Thanks for fixing.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_debugfs.c | 15 ++++++---------
> tools/intel_display_poller.c | 8 +-------
> tools/intel_forcewaked.c | 9 ++-------
> tools/intel_gpu_top.c | 7 +------
> tools/intel_guc_logger.c | 10 +++-------
> tools/intel_infoframes.c | 7 +------
> tools/intel_panel_fitter.c | 8 ++------
> tools/intel_reg.c | 10 +++-------
> tools/intel_watermark.c | 20 +++++++-------------
> 9 files changed, 26 insertions(+), 68 deletions(-)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 40cfd87a..658126e3 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -150,18 +150,15 @@ char *igt_debugfs_path(int device, char *path, int pathlen)
> const char *debugfs_root;
> int idx;
>
> - if (fstat(device, &st)) {
> - igt_debug("Couldn't stat FD for DRM device: %s\n", strerror(errno));
> - return NULL;
> - }
> + debugfs_root = igt_debugfs_mount();
> + igt_assert(debugfs_root);
>
> - if (!S_ISCHR(st.st_mode)) {
> + memset(&st, 0, sizeof(st));
> + if (fstat(device, &st))
> + igt_debug("Couldn't stat FD for DRM device: %s\n", strerror(errno));
> + else if (!S_ISCHR(st.st_mode))
> igt_debug("FD for DRM device not a char device!\n");
> - return NULL;
> - }
>
> - debugfs_root = igt_debugfs_mount();
> - igt_assert(debugfs_root);
>
> idx = minor(st.st_rdev);
> snprintf(path, pathlen, "%s/dri/%d/name", debugfs_root, idx);
> diff --git a/tools/intel_display_poller.c b/tools/intel_display_poller.c
> index 828ca52b..a26e2ecf 100644
> --- a/tools/intel_display_poller.c
> +++ b/tools/intel_display_poller.c
> @@ -965,7 +965,6 @@ int main(int argc, char *argv[])
> int pipe = 0, bit = 0, target_scanline = 0, target_fuzz = 1;
> bool test_pixelcount = false;
> uint32_t devid;
> - int drm_fd;
> uint32_t min[2*128] = {};
> uint32_t max[2*128] = {};
> uint32_t a, b;
> @@ -1187,10 +1186,7 @@ int main(int argc, char *argv[])
> break;
> }
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> printf("%s?\n", test_name(test, pipe, bit, test_pixelcount));
>
> @@ -1267,8 +1263,6 @@ int main(int argc, char *argv[])
>
> intel_register_access_fini();
>
> - close(drm_fd);
> -
> if (quit)
> return 0;
>
> diff --git a/tools/intel_forcewaked.c b/tools/intel_forcewaked.c
> index aa8e3f8b..02fbf888 100644
> --- a/tools/intel_forcewaked.c
> +++ b/tools/intel_forcewaked.c
> @@ -64,7 +64,6 @@ is_alive(void) {
>
> int main(int argc, char *argv[])
> {
> - int drm_fd;
> int ret;
>
> if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) {
> @@ -81,10 +80,7 @@ int main(int argc, char *argv[])
> INFO_PRINT("started daemon");
> }
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> - ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd);
> + ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
> if (ret) {
> INFO_PRINT("Couldn't init register access\n");
> exit(1);
> @@ -95,14 +91,13 @@ int main(int argc, char *argv[])
> if (!is_alive()) {
> INFO_PRINT("gpu reset? restarting daemon\n");
> intel_register_access_fini();
> - ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd);
> + ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
> if (ret)
> INFO_PRINT("Reg access init fail\n");
> }
> sleep(1);
> }
> intel_register_access_fini();
> - close(drm_fd);
> INFO_PRINT("Forcewake unlock\n");
>
> if (daemonized) {
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 7454de87..83cf53ea 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -409,7 +409,6 @@ usage(const char *appname)
> int main(int argc, char **argv)
> {
> uint32_t devid;
> - int drm_fd;
> struct pci_device *pci_dev;
> struct ring render_ring = {
> .name = "render",
> @@ -510,11 +509,8 @@ int main(int argc, char **argv)
> top_bits_sorted[i] = &top_bits[i];
> }
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver(DRIVER_INTEL);
> -
> /* Grab access to the registers */
> - intel_register_access_init(pci_dev, 0, drm_fd);
> + intel_register_access_init(pci_dev, 0, -1);
>
> ring_init(&render_ring);
> if (IS_GEN4(devid) || IS_GEN5(devid))
> @@ -717,6 +713,5 @@ int main(int argc, char **argv)
> fclose(output);
>
> intel_register_access_fini();
> - close(drm_fd);
> return 0;
> }
> diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c
> index 7c6115a6..031fd84d 100644
> --- a/tools/intel_guc_logger.c
> +++ b/tools/intel_guc_logger.c
> @@ -46,7 +46,7 @@ int verbosity_level = 3; /* by default capture logs at max verbosity */
> uint32_t produced, consumed;
> uint64_t total_bytes_written;
> int num_buffers = NUM_SUBBUFS;
> -int relay_fd, drm_fd, outfile_fd = -1;
> +int relay_fd, outfile_fd = -1;
> uint32_t test_duration, max_filesize;
> pthread_cond_t underflow_cond, overflow_cond;
> bool stop_logging, discard_oldlogs, capturing_stopped;
> @@ -58,7 +58,7 @@ static void guc_log_control(bool enable_logging)
> uint64_t val;
> int ret;
>
> - control_fd = igt_debugfs_open(drm_fd, CONTROL_FILE_NAME, O_WRONLY);
> + control_fd = igt_debugfs_open(-1, CONTROL_FILE_NAME, O_WRONLY);
> igt_assert_f(control_fd >= 0, "couldn't open the guc log control file\n");
>
> val = enable_logging ? ((verbosity_level << 4) | 0x1) : 0;
> @@ -227,7 +227,7 @@ static void init_flusher_thread(void)
>
> static void open_relay_file(void)
> {
> - relay_fd = igt_debugfs_open(drm_fd, RELAY_FILE_NAME, O_RDONLY);
> + relay_fd = igt_debugfs_open(-1, RELAY_FILE_NAME, O_RDONLY);
> igt_assert_f(relay_fd >= 0, "couldn't open the guc log file\n");
>
> /* Purge the old/boot-time logs from the relay buffer.
> @@ -373,9 +373,6 @@ int main(int argc, char **argv)
>
> process_command_line(argc, argv);
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> init_main_thread();
>
> /* Use a separate thread for flushing the logs to a file on disk.
> @@ -436,6 +433,5 @@ int main(int argc, char **argv)
> free(read_buffer);
> close(relay_fd);
> close(outfile_fd);
> - close(drm_fd);
> igt_exit();
> }
> diff --git a/tools/intel_infoframes.c b/tools/intel_infoframes.c
> index 813430c9..2ef5d4fd 100644
> --- a/tools/intel_infoframes.c
> +++ b/tools/intel_infoframes.c
> @@ -1081,7 +1081,6 @@ printf("Options:\n"
> int main(int argc, char *argv[])
> {
> int opt;
> - int drm_fd;
> int ret = 0;
> Transcoder transcoder = TRANSC_INVALID;
> DipType dip = DIP_INVALID;
> @@ -1108,11 +1107,8 @@ int main(int argc, char *argv[])
> printf("WARNING: This is just a debugging tool! Don't expect it to work"
> " perfectly: the Kernel might undo our changes.\n");
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> pci_dev = intel_get_pci_device();
> - intel_register_access_init(pci_dev, 0, drm_fd);
> + intel_register_access_init(pci_dev, 0, -1);
> intel_check_pch();
>
> if (IS_GEN4(pci_dev->device_id))
> @@ -1261,6 +1257,5 @@ int main(int argc, char *argv[])
>
> out:
> intel_register_access_fini();
> - close(drm_fd);
> return ret;
> }
> diff --git a/tools/intel_panel_fitter.c b/tools/intel_panel_fitter.c
> index 48b2fd89..137ef61a 100644
> --- a/tools/intel_panel_fitter.c
> +++ b/tools/intel_panel_fitter.c
> @@ -266,7 +266,7 @@ static void print_usage(void)
>
> int main (int argc, char *argv[])
> {
> - int opt, drm_fd;
> + int opt;
> int ret = 0;
> char intel_pipe = '\0';
> int x = 0, y = 0;
> @@ -279,11 +279,8 @@ int main (int argc, char *argv[])
> "with overscan compensation properties: it is just a temporary "
> "solution that may or may not work. Use it at your own risk.\n");
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> pci_dev = intel_get_pci_device();
> - intel_register_access_init(pci_dev, 0, drm_fd);
> + intel_register_access_init(pci_dev, 0, -1);
> devid = pci_dev->device_id;
>
> if (!HAS_PCH_SPLIT(devid)) {
> @@ -346,6 +343,5 @@ int main (int argc, char *argv[])
>
> out:
> intel_register_access_fini();
> - close(drm_fd);
> return ret;
> }
> diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> index d6f81840..00d2a4a1 100644
> --- a/tools/intel_reg.c
> +++ b/tools/intel_reg.c
> @@ -58,7 +58,6 @@ struct config {
> struct pci_device *pci_dev;
> char *mmiofile;
> uint32_t devid;
> - int drm_fd;
>
> /* read: number of registers to read */
> uint32_t count;
> @@ -411,7 +410,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
> if (config->mmiofile)
> intel_mmio_use_dump_file(config->mmiofile);
> else
> - intel_register_access_init(config->pci_dev, 0, config->drm_fd);
> + intel_register_access_init(config->pci_dev, 0, -1);
>
> for (i = 1; i < argc; i++) {
> struct reg reg;
> @@ -441,7 +440,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
> return EXIT_FAILURE;
> }
>
> - intel_register_access_init(config->pci_dev, 0, config->drm_fd);
> + intel_register_access_init(config->pci_dev, 0, -1);
>
> for (i = 1; i < argc; i += 2) {
> struct reg reg;
> @@ -479,7 +478,7 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
> if (config->mmiofile)
> intel_mmio_use_dump_file(config->mmiofile);
> else
> - intel_register_access_init(config->pci_dev, 0, config->drm_fd);
> + intel_register_access_init(config->pci_dev, 0, -1);
>
> for (i = 0; i < config->regcount; i++) {
> reg = &config->regs[i];
> @@ -879,9 +878,6 @@ int main(int argc, char *argv[])
> config.devid = config.pci_dev->device_id;
> }
>
> - /* Just to make sure we open the right debugfs files */
> - config.drm_fd = __drm_open_driver(DRIVER_INTEL);
> -
> if (read_reg_spec(&config) < 0) {
> return EXIT_FAILURE;
> }
> diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c
> index d8c78480..de0b0831 100644
> --- a/tools/intel_watermark.c
> +++ b/tools/intel_watermark.c
> @@ -34,7 +34,6 @@
>
> static uint32_t display_base;
> static uint32_t devid;
> -static int drm_fd;
>
> static uint32_t read_reg(uint32_t addr)
> {
> @@ -143,7 +142,7 @@ static void ilk_wm_dump(void)
> int num_pipes = is_gen7_plus(devid) ? 3 : 2;
> struct ilk_wm wm = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> for (i = 0; i < num_pipes; i++) {
> dspcntr[i] = read_reg(0x70180 + i * 0x1000);
> @@ -291,7 +290,7 @@ static void vlv_wm_dump(void)
> uint32_t dsp_ss_pm, ddr_setup2;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dsparb = read_reg(0x70030);
> dsparb2 = read_reg(0x70060);
> @@ -507,7 +506,7 @@ static void g4x_wm_dump(void)
> uint32_t mi_arb_state;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dspacntr = read_reg(0x70180);
> dspbcntr = read_reg(0x71180);
> @@ -593,7 +592,7 @@ static void gen4_wm_dump(void)
> uint32_t mi_arb_state;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dsparb = read_reg(0x70030);
> fw1 = read_reg(0x70034);
> @@ -664,7 +663,7 @@ static void pnv_wm_dump(void)
> uint32_t cbr;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dsparb = read_reg(0x70030);
> fw1 = read_reg(0x70034);
> @@ -754,7 +753,7 @@ static void gen3_wm_dump(void)
> uint32_t mi_arb_state;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dsparb = read_reg(0x70030);
> instpm = read_reg(0x20c0);
> @@ -823,7 +822,7 @@ static void gen2_wm_dump(void)
> uint32_t mi_state;
> struct gmch_wm wms[MAX_PLANE] = {};
>
> - intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
> + intel_register_access_init(intel_get_pci_device(), 0, -1);
>
> dsparb = read_reg(0x70030);
> mem_mode = read_reg(0x20cc);
> @@ -900,9 +899,6 @@ int main(int argc, char *argv[])
> {
> devid = intel_get_pci_device()->device_id;
>
> - /* Just to make sure we open the right debugfs files */
> - drm_fd = drm_open_driver_master(DRIVER_INTEL);
> -
> if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) {
> display_base = 0x180000;
> vlv_wm_dump();
> @@ -923,7 +919,5 @@ int main(int argc, char *argv[])
> return 1;
> }
>
> - close(drm_fd);
> -
> return 0;
> }
> --
> 2.15.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* ✓ Fi.CI.IGT: success for tools: Stop opening the driver just to find the debugfs
2017-11-20 16:01 [PATCH igt] tools: Stop opening the driver just to find the debugfs Chris Wilson
2017-11-20 16:23 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-20 17:13 ` [PATCH igt] " Ville Syrjälä
@ 2017-11-20 18:22 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-11-20 18:22 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: tools: Stop opening the driver just to find the debugfs
URL : https://patchwork.freedesktop.org/series/34107/
State : success
== Summary ==
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-pri-shrfb-draw-blt:
fail -> PASS (shard-snb) fdo#103167
Subgroup fbc-1p-primscrn-pri-indfb-draw-render:
fail -> PASS (shard-snb) fdo#101623 +1
Test perf:
Subgroup blocking:
pass -> FAIL (shard-hsw) fdo#102252
Test kms_plane:
Subgroup plane-panning-bottom-right-suspend-pipe-b-planes:
skip -> PASS (shard-hsw)
Test kms_cursor_legacy:
Subgroup long-nonblocking-modeset-vs-cursor-atomic:
skip -> PASS (shard-hsw) fdo#103181
Test drv_selftest:
Subgroup mock_sanitycheck:
pass -> DMESG-WARN (shard-hsw) fdo#103719
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103181 https://bugs.freedesktop.org/show_bug.cgi?id=103181
fdo#103719 https://bugs.freedesktop.org/show_bug.cgi?id=103719
shard-hsw total:2585 pass:1472 dwarn:2 dfail:1 fail:11 skip:1099 time:9405s
shard-snb total:2585 pass:1261 dwarn:1 dfail:1 fail:11 skip:1311 time:7907s
Blacklisted hosts:
shard-apl total:2563 pass:1598 dwarn:1 dfail:0 fail:26 skip:937 time:12604s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_513/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH igt] tools: Stop opening the driver just to find the debugfs
2017-11-20 17:13 ` [PATCH igt] " Ville Syrjälä
@ 2017-11-21 12:01 ` Chris Wilson
0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-11-21 12:01 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
Quoting Ville Syrjälä (2017-11-20 17:13:37)
> On Mon, Nov 20, 2017 at 04:01:24PM +0000, Chris Wilson wrote:
> > Since the tools want to work without the module loaded, remove the
> > assumption that we want to load the driver to find debugfs.
>
> So looking at the history it was actually Tomeu that caused this
> problem originally. That added the bogus master requirement
> as well. So now I can forget my patch to drop the master requirement
> from intel_watermark as well. Thanks for fixing.
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
And pushed. On my wishlist is that we move the test harness over to
tests/lib (including convenience interfaces) leaving lib/ as the
lowlevel interfaces that can be used outside of igt_main. (No
igt_require/igt_assert, standard error reporting etc.)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-21 12:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 16:01 [PATCH igt] tools: Stop opening the driver just to find the debugfs Chris Wilson
2017-11-20 16:23 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-20 17:13 ` [PATCH igt] " Ville Syrjälä
2017-11-21 12:01 ` Chris Wilson
2017-11-20 18:22 ` ✓ Fi.CI.IGT: success for " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.