Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
PATCH 1/1 Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
From: Ville Syrjälä <[email protected]>
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability.
This reverts commit 8ae86621d6fff60b6e20c6b0f9b336785c935b0f.
--- benchmarks/gem_latency.c | 4 +- benchmarks/gem_wsim.c | 4 +- debugger/debug_rdata.c | 7 +- debugger/eudb.c | 8 +-- lib/igt_device.c | 120 -------------------------------- lib/igt_device.h | 1 - lib/intel_chipset.c | 51 ++++++++++++++ lib/intel_chipset.h | 1 + lib/intel_mmio.c | 4 +- lib/ioctl_wrappers.c | 5 +- lib/ioctl_wrappers.h | 2 +- tests/i915/gem_concurrent_all.c | 12 ++-- tests/i915/gem_cpu_reloc.c | 4 +- tests/i915/gem_exec_latency.c | 3 +- tests/i915/gem_exec_parse.c | 4 +- tests/i915/gem_mmap.c | 4 +- tests/i915/gem_mmap_gtt.c | 10 +-- tests/i915/gem_pwrite.c | 4 +- tests/i915/gem_shrink.c | 2 +- tests/i915/i915_pm_lpsp.c | 3 +- tests/i915/i915_pm_rpm.c | 4 +- tests/kms_flip.c | 2 +- tests/prime_mmap.c | 4 +- tools/intel_audio_dump.c | 9 +-- tools/intel_backlight.c | 8 +-- tools/intel_display_poller.c | 8 +-- tools/intel_forcewaked.c | 10 +-- tools/intel_gpu_time.c | 8 +-- tools/intel_gtt.c | 8 +-- tools/intel_infoframes.c | 7 +- tools/intel_l3_parity.c | 3 +- tools/intel_lid.c | 9 +-- tools/intel_panel_fitter.c | 8 +-- tools/intel_perf_counters.c | 3 +- tools/intel_reg.c | 23 +++--- tools/intel_reg_checker.c | 8 +-- tools/intel_watermark.c | 23 +++--- 37 files changed, 131 insertions(+), 267 deletions(-)
benchmarks/gem_latency.c +1 -3
@@ -44,8 +44,6 @@#include <sys/resource.h> #include "drm.h" -#include "igt_device.h" -#define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)
@@ -458,7 +456,7 @@ static int run(int seconds,if (gen <6 )return IGT_EXIT_SKIP ;/* Needs BCS timestamp */ -intel_register_access_init (igt_device_get_pci_device (fd), false, fd); +intel_register_access_init (intel_get_pci_device (), false, fd);if (gen ==6 ) timestamp_reg =REG (RCS_TIMESTAMP );
benchmarks/gem_wsim.c +2 -2
@@ -41,6 +41,7 @@#include <limits.h> #include <pthread.h> +#include "intel_chipset.h" #include "intel_reg.h" #include "drm.h"
@@ -49,7 +50,6 @@#include "intel_io.h" #include "igt_aux.h" -#include "igt_device.h" #include "igt_rand.h" #include "igt_perf.h" #include "sw_sync.h"
@@ -2223,7 +2223,7 @@ static void init_clocks(void)uint32_t rcs_start, rcs_end;double overhead, t; -intel_register_access_init (igt_device_get_pci_device (fd), false, fd); +intel_register_access_init (intel_get_pci_device (), false, fd);if (verbose <=1 )return ;
debugger/debug_rdata.c +2 -5
@@ -29,6 +29,7 @@#include <stdio.h> #include <stdlib.h> #include "intel_io.h" +#include "intel_chipset.h" struct eu_rdata { union {
@@ -132,11 +133,7 @@ find_stuck_threads(void)int main (int argc,char *argv[]) {struct pci_device *pci_dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,1 );find_stuck_threads ();
debugger/eudb.c +3 -5
@@ -42,6 +42,7 @@#include "drm.h" #include "i915_drm.h" #include "drmtest.h" +#include "intel_chipset.h" #include "intel_bufmgr.h" #include "intel_io.h" #include "intel_batchbuffer.h"
@@ -505,7 +506,7 @@ int main(int argc, char* argv[]) {struct pci_device *pci_dev;volatile uint8_t *scratch =NULL ;int bits[64 ]; -int devid =-1 , opt, fd; +int devid =-1 , opt;while ((opt =getopt (argc, argv,"cdr:pf?h" )) !=-1 ) {switch (opt) {
@@ -532,10 +533,7 @@ int main(int argc, char* argv[]) { } } - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();if (devid ==-1 ) devid = pci_dev->device_id;if (identify_device (devid)) {
lib/igt_device.c +0 -120
129 lines not on this page · raw message
lib/igt_device.h +0 -1
@@ -32,6 +32,5 @@ int __igt_device_drop_master(int fd);void igt_device_drop_master (int fd);int igt_device_get_card_index (int fd); -struct pci_device *igt_device_get_pci_device (int fd);#endif /* __IGT_DEVICE_H__ */
lib/intel_chipset.c +51 -0
57 lines not on this page · raw message
lib/intel_chipset.h +1 -0
@@ -31,6 +31,7 @@#include <pciaccess.h> #include <stdbool.h> +struct pci_device *intel_get_pci_device (void );uint32_t intel_get_drm_devid (int fd);struct intel_device_info {
lib/intel_mmio.c +2 -2
@@ -112,7 +112,7 @@ intel_mmio_use_dump_file(char *file)* * Sets up #igt_global_mmio to point at the mmio bar. * -* @pci_dev can be obtained from igt_device_get_pci_device(). +* @pci_dev can be obtained from intel_get_pci_device(). */ void intel_mmio_use_pci_bar (struct pci_device *pci_dev)
@@ -162,7 +162,7 @@ release_forcewake_lock(int fd)* * It also initializes #igt_global_mmio like intel_mmio_use_pci_bar(). * -* @pci_dev can be obtained from igt_device_get_pci_device(). +* @pci_dev can be obtained from intel_get_pci_device(). */ int intel_register_access_init (struct pci_device *pci_dev,int safe,int fd)
lib/ioctl_wrappers.c +2 -3
@@ -53,7 +53,6 @@#include "intel_chipset.h" #include "intel_io.h" #include "igt_debugfs.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "config.h"
@@ -1097,9 +1096,9 @@ uint64_t gem_aperture_size(int fd)* * Returns: The mappable gtt address space size. */ -uint64_t gem_mappable_aperture_size (int fd) +uint64_t gem_mappable_aperture_size (void ) { -struct pci_device *pci_dev =igt_device_get_pci_device (fd); +struct pci_device *pci_dev =intel_get_pci_device ();int bar;if (intel_gen (pci_dev->device_id) <3 )
lib/ioctl_wrappers.h +1 -1
@@ -136,7 +136,7 @@ uint64_t gem_total_stolen_size(int fd);uint64_t gem_available_aperture_size (int fd);uint64_t gem_aperture_size (int fd);uint64_t gem_global_aperture_size (int fd); -uint64_t gem_mappable_aperture_size (int fd); +uint64_t gem_mappable_aperture_size (void );bool gem_has_softpin (int fd);bool gem_has_exec_fence (int fd);
tests/i915/gem_concurrent_all.c +6 -6
@@ -1850,7 +1850,7 @@ igt_main c->name, s->name, "small"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd)/4 , + count =num_buffers (gem_mappable_aperture_size ()/4 , s, c,CHECK_RAM ); }run_modes (name, c, modes, s, count);
@@ -1861,7 +1861,7 @@ igt_main c->name, s->name, "thrash"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM ); }run_modes (name, c, modes, s, count);
@@ -1893,7 +1893,7 @@ igt_main c->name, s->name, "shrink"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM );igt_fork_shrink_helper (fd);
@@ -1909,8 +1909,8 @@ igt_main c->name, s->name, "swap"); igt_subtest_group { igt_fixture { -if (intel_get_avail_ram_mb () >gem_mappable_aperture_size (fd)/(1024 *1024 )) { - pin_sz =intel_get_avail_ram_mb () -gem_mappable_aperture_size (fd)/(1024 *1024 ); +if (intel_get_avail_ram_mb () >gem_mappable_aperture_size ()/(1024 *1024 )) { + pin_sz =intel_get_avail_ram_mb () -gem_mappable_aperture_size ()/(1024 *1024 );igt_debug ("Pinning %lld MiB\n" , (long long )pin_sz); pin_sz *=1024 *1024 ;
@@ -1924,7 +1924,7 @@ igt_mainigt_require (pinned); } - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM |CHECK_SWAP ); }run_modes (name, c, modes, s, count);
tests/i915/gem_cpu_reloc.c +2 -2
@@ -283,7 +283,7 @@ igt_mainrun_test (i915,1 ); igt_subtest("full") { -uint64_t aper_size =gem_mappable_aperture_size (i915); +uint64_t aper_size =gem_mappable_aperture_size ();unsigned long count = aper_size /4096 +1 ;intel_require_memory (count,4096 ,CHECK_RAM );
@@ -292,7 +292,7 @@ igt_main } igt_subtest("forked") { -uint64_t aper_size =gem_mappable_aperture_size (i915); +uint64_t aper_size =gem_mappable_aperture_size ();unsigned long count = aper_size /4096 +1 ;int ncpus =sysconf (_SC_NPROCESSORS_ONLN);
tests/i915/gem_exec_latency.c +1 -2
@@ -40,7 +40,6 @@#include "drm.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "igt_vgem.h" #include "igt_dummyload.h"
@@ -680,7 +679,7 @@ igt_mainif (ring_size >1024 ) ring_size =1024 ; -intel_register_access_init (igt_device_get_pci_device (device), false, device); +intel_register_access_init (intel_get_pci_device (), false, device); rcs_clock =clockrate (device,RCS_TIMESTAMP );igt_info ("RCS timestamp clock: %.0fKHz, %.1fns\n" , rcs_clock /1e3 ,1e9 / rcs_clock);
tests/i915/gem_exec_parse.c +1 -3
@@ -30,8 +30,6 @@#include <drm.h> -#include "igt_device.h" -#ifndef I915_PARAM_CMD_PARSER_VERSION #define I915_PARAM_CMD_PARSER_VERSION 28#endif
@@ -532,7 +530,7 @@ igt_main#undef REG igt_fixture { -intel_register_access_init (igt_device_get_pci_device (fd),0 , fd); +intel_register_access_init (intel_get_pci_device (),0 , fd); }for (int i =0 ; i <ARRAY_SIZE (lris); i++) {
tests/i915/gem_mmap.c +2 -2
@@ -53,10 +53,10 @@ test_huge_bo(int huge)switch (huge) {case -1 : - huge_object_size =gem_mappable_aperture_size (fd) /2 ; + huge_object_size =gem_mappable_aperture_size () /2 ;break ;case 0 : - huge_object_size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + huge_object_size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;case 1 : huge_object_size =gem_aperture_size (fd) +PAGE_SIZE ;
tests/i915/gem_mmap_gtt.c +5 -5
@@ -562,7 +562,7 @@ test_huge_bo(int fd, int huge, int tiling)switch (huge) {case -1 : - size =gem_mappable_aperture_size (fd) /2 ; + size =gem_mappable_aperture_size () /2 ;/* Power of two fence size, natural fence * alignment, and the guard page at the end
@@ -577,7 +577,7 @@ test_huge_bo(int fd, int huge, int tiling) size /=2 ;break ;case 0 : - size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;default : size =gem_global_aperture_size (fd) +PAGE_SIZE ;
@@ -658,13 +658,13 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b, int ncpus)switch (huge) {case -2 : - huge_object_size =gem_mappable_aperture_size (fd) /4 ; + huge_object_size =gem_mappable_aperture_size () /4 ;break ;case -1 : - huge_object_size =gem_mappable_aperture_size (fd) /2 ; + huge_object_size =gem_mappable_aperture_size () /2 ;break ;case 0 : - huge_object_size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + huge_object_size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;case 1 : huge_object_size =gem_global_aperture_size (fd) +PAGE_SIZE ;
tests/i915/gem_pwrite.c +2 -2
@@ -89,7 +89,7 @@ static void test_big_cpu(int fd, int scale, unsigned flags)switch (scale) {case 0 : - size =gem_mappable_aperture_size (fd) +4096 ; + size =gem_mappable_aperture_size () +4096 ;break ;case 1 : size =gem_global_aperture_size (fd) +4096 ;
@@ -151,7 +151,7 @@ static void test_big_gtt(int fd, int scale, unsigned flags)igt_require (gem_mmap__has_wc (fd));switch (scale) {case 0 : - size =gem_mappable_aperture_size (fd) +4096 ; + size =gem_mappable_aperture_size () +4096 ;break ;case 1 : size =gem_global_aperture_size (fd) +4096 ;
tests/i915/gem_shrink.c +1 -1
@@ -413,7 +413,7 @@ igt_main* we expect the shrinker to start purging objects, * and possibly fail. */ - alloc_size =gem_mappable_aperture_size (fd) /2 ; + alloc_size =gem_mappable_aperture_size () /2 ; num_processes =1 + (mem_size / (alloc_size >>20 )); igt_info("Using %d processes and %'lluMiB per process\n",
tests/i915/i915_pm_lpsp.c +1 -2
@@ -30,7 +30,6 @@#include <fcntl.h> #include <unistd.h> -#include "igt_device.h" static bool supports_lpsp (uint32_t devid) {
@@ -211,7 +210,7 @@ igt_mainigt_require (supports_lpsp (devid)); -intel_register_access_init (igt_device_get_pci_device (drm_fd),0 , drm_fd); +intel_register_access_init (intel_get_pci_device (),0 , drm_fd);kmstest_set_vt_graphics_mode (); }
tests/i915/i915_pm_rpm.c +2 -2
@@ -1368,7 +1368,7 @@ static void gem_evict_pwrite_subtest(void)unsigned int num_trash_bos, n;uint32_t buf; - num_trash_bos =gem_mappable_aperture_size (drm_fd) / (1024 *1024 ) +1 ; + num_trash_bos =gem_mappable_aperture_size () / (1024 *1024 ) +1 ; trash_bos =malloc (num_trash_bos *sizeof (*trash_bos));igt_assert (trash_bos);
@@ -1412,7 +1412,7 @@ static bool device_in_pci_d3(void)uint16_t val;int rc; - rc =pci_device_cfg_read_u16 (igt_device_get_pci_device (drm_fd), &val,0xd4 ); + rc =pci_device_cfg_read_u16 (intel_get_pci_device (), &val,0xd4 );igt_assert_eq (rc,0 );igt_debug ("%s: PCI D3 state=%d\n" , __func__, val &0x3 );
tests/kms_flip.c +1 -1
@@ -1224,7 +1224,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,/* 256 MB is usually the maximum mappable aperture, * (make it 4x times that to ensure failure) */ if (o->flags &TEST_BO_TOOBIG ) { - bo_size =4 *gem_mappable_aperture_size (drm_fd); + bo_size =4 *gem_mappable_aperture_size ();igt_require (bo_size <gem_global_aperture_size (drm_fd)); }
tests/prime_mmap.c +2 -2
@@ -447,8 +447,8 @@ test_aperture_limit(void)char *ptr1, *ptr2;uint32_t handle1, handle2;/* Two buffers the sum of which > mappable aperture */ -uint64_t size1 = (gem_mappable_aperture_size (fd) *7 ) /8 ; -uint64_t size2 = (gem_mappable_aperture_size (fd) *3 ) /8 ; +uint64_t size1 = (gem_mappable_aperture_size () *7 ) /8 ; +uint64_t size2 = (gem_mappable_aperture_size () *3 ) /8 ; handle1 =gem_create (fd, size1);fill_bo (handle1,BO_SIZE );
tools/intel_audio_dump.c +1 -8
@@ -32,7 +32,6 @@#include <string.h> #include <err.h> #include <arpa/inet.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_reg.h" #include "intel_chipset.h"
@@ -2465,12 +2464,8 @@ static void dump_braswell(void)int main (int argc,char **argv) {struct pci_device *pci_dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); + pci_dev =intel_get_pci_device (); devid = pci_dev->device_id;/* XXX not true when mapping! */ do_self_tests ();
@@ -2498,7 +2493,5 @@ int main(int argc, char **argv)dump_eaglelake (); } -close (fd); -return 0 ; }
tools/intel_backlight.c +2 -6
@@ -30,9 +30,8 @@#include <stdio.h> #include <string.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg.h" /* XXX PCH only today */
@@ -40,11 +39,8 @@int main (int argc,char ** argv) {uint32_t current, max; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ()); current =INREG (BLC_PWM_CPU_CTL ) &BACKLIGHT_DUTY_CYCLE_MASK ; max =INREG (BLC_PWM_PCH_CTL2 ) >>16 ;
tools/intel_display_poller.c +2 -6
@@ -36,7 +36,6 @@#include "intel_io.h" #include "intel_reg.h" #include "igt_debugfs.h" -#include "igt_device.h" #include "drmtest.h" #include "igt_aux.h"
@@ -972,7 +971,6 @@ int main(int argc, char *argv[])uint32_t a, b;enum test test =TEST_INVALID ;const int count =ARRAY_SIZE (min)/2 ; -int fd;for (;;) {static const struct option long_options[] = {
@@ -1048,8 +1046,7 @@ int main(int argc, char *argv[]) } } - fd =drm_open_driver (DRIVER_INTEL ); - devid =igt_device_get_pci_device (fd)->device_id; + devid =intel_get_pci_device ()->device_id;/* * check if the requires registers are
@@ -1190,7 +1187,7 @@ int main(int argc, char *argv[])break ; } -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );printf ("%s?\n" ,test_name (test, pipe, bit, test_pixelcount));
@@ -1266,7 +1263,6 @@ int main(int argc, char *argv[]) }intel_register_access_fini (); -close (fd);if (quit)return 0 ;
tools/intel_forcewaked.c +3 -7
@@ -34,8 +34,8 @@#include <stdlib.h> #include <syslog.h> #include <unistd.h> -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "drmtest.h" bool daemonized;
@@ -65,7 +65,6 @@ is_alive(void) {int main (int argc,char *argv[]) {int ret; -int fd;if (argc >2 || (argc ==2 && !strncmp (argv[1 ],"-h" ,2 ))) {help (argv[1 ]);
@@ -81,27 +80,24 @@ int main(int argc, char *argv[])INFO_PRINT ("started daemon" ); } - fd =drm_open_driver (DRIVER_INTEL ); - ret =intel_register_access_init (igt_device_get_pci_device (fd),1 ,-1 ); + ret =intel_register_access_init (intel_get_pci_device (),1 ,-1 );if (ret) {INFO_PRINT ("Couldn't init register access\n" );exit (1 ); }else {INFO_PRINT ("Forcewake locked\n" ); } -while (1 ) {if (!is_alive ()) {INFO_PRINT ("gpu reset? restarting daemon\n" );intel_register_access_fini (); - ret =intel_register_access_init (igt_device_get_pci_device (fd),1 ,-1 ); + 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 (fd);INFO_PRINT ("Forcewake unlock\n" );if (daemonized) {
tools/intel_gpu_time.c +2 -6
@@ -34,9 +34,8 @@#include <sys/resource.h> #include <sys/wait.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg.h" #define SAMPLES_PER_SEC 10000
@@ -67,11 +66,8 @@ int main(int argc, char **argv)struct timeval start, end;static struct rusage rusage;int status; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ());if (argc ==1 ) {fprintf (stderr,"usage: %s cmd [args...]\n" , argv[0 ]);
tools/intel_gtt.c +1 -7
@@ -34,8 +34,6 @@#include <pciaccess.h> #include <unistd.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h"
@@ -142,17 +140,13 @@ int main(int argc, char **argv) {struct pci_device *pci_dev;unsigned int start, gtt_size; -int fd;int flag[] = {PCI_DEV_MAP_FLAG_WRITE_COMBINE ,PCI_DEV_MAP_FLAG_WRITABLE ,0 }, f; - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device (); devid = pci_dev->device_id;if (IS_GEN2 (devid)) {
tools/intel_infoframes.c +1 -6
@@ -30,7 +30,6 @@#include <stdlib.h> #include <string.h> #include <getopt.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "drmtest.h"
@@ -1082,7 +1081,6 @@ printf("Options:\n"int main (int argc,char *argv[]) {int opt; -int fd;int ret =0 ;Transcoder transcoder =TRANSC_INVALID ;DipType dip =DIP_INVALID ;
@@ -1109,10 +1107,7 @@ 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" ); - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,0 ,-1 );intel_check_pch ();
tools/intel_l3_parity.c +1 -2
@@ -36,7 +36,6 @@#include <getopt.h> #include "intel_chipset.h" #include "intel_io.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "drmtest.h" #include "config.h"
@@ -190,7 +189,7 @@ int main(int argc, char *argv[])if (intel_gen (devid) <7 ||IS_VALLEYVIEW (devid))exit (77 ); -assert (intel_register_access_init (igt_device_get_pci_device (device),0 , device) ==0 ); +assert (intel_register_access_init (intel_get_pci_device (),0 , device) ==0 ); dir =igt_sysfs_open (device);
tools/intel_lid.c +2 -7
@@ -37,10 +37,9 @@#include <sys/stat.h> #include <sys/types.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_reg.h" +#include "intel_chipset.h" #define SWF14_LID_STATUS_CLOSED (1<<29)/* 0 here means open */
@@ -119,11 +118,8 @@ out:int main (int argc,char **argv) {int swf14, acpi_lid; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ());while (1 ) { swf14 =INREG (SWF14 );
@@ -146,6 +142,5 @@ int main(int argc, char **argv) }sleep (2 ); } -return 0 ; }
tools/intel_panel_fitter.c +1 -7
@@ -30,7 +30,6 @@#include <unistd.h> #include <stdlib.h> #include <string.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "intel_reg.h"
@@ -274,17 +273,13 @@ int main (int argc, char *argv[])bool do_disable = false, do_dump = false, do_usage = false;struct pci_device *pci_dev;uint32_t devid; -int fd;printf ("WARNING:\n" "This tool is a workaround for people that don't have a Kernel " "with overscan compensation properties: it is just a temporary " "solution that may or may not work. Use it at your own risk.\n" ); - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,0 ,-1 ); devid = pci_dev->device_id;
@@ -348,6 +343,5 @@ int main (int argc, char *argv[]) out:intel_register_access_fini (); -return ret; }
tools/intel_perf_counters.c +1 -2
@@ -45,7 +45,6 @@#include "drm.h" #include "i915_drm.h" #include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h"
@@ -484,7 +483,7 @@ main(int argc, char **argv)if (oacontrol) {/* Forcewake */ -intel_register_access_init (igt_device_get_pci_device (fd),0 , fd); +intel_register_access_init (intel_get_pci_device (),0 , fd);/* Enable performance counters */ intel_register_write(OACONTROL,
tools/intel_reg.c +13 -10
@@ -33,9 +33,9 @@#include <unistd.h> #include "igt.h" -#include "igt_device.h" #include "igt_gt.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg_spec.h"
@@ -274,6 +274,15 @@ static int register_srm(struct config *config, struct reg *reg,int fd, i;uint32_t val; +if (config->fd ==-1 ) { + config->fd =__drm_open_driver (DRIVER_INTEL ); +if (config->fd ==-1 ) { +fprintf (stderr,"Error opening driver: %s" , +strerror (errno)); +exit (EXIT_FAILURE ); + } + } + fd = config->fd; engine =find_engine (reg->engine);if (engine ==NULL )
@@ -1006,13 +1015,6 @@ int main(int argc, char *argv[])return EXIT_FAILURE ; } - config.fd =__drm_open_driver (DRIVER_INTEL ); -if (config.fd ==-1 ) { -fprintf (stderr,"Error opening driver: %s" , -strerror (errno)); -exit (EXIT_FAILURE ); - } -if (config.mmiofile) {if (!config.devid) {fprintf (stderr,"--mmio requires --devid\n" );
@@ -1024,7 +1026,7 @@ int main(int argc, char *argv[])fprintf (stderr,"--devid without --mmio\n" );return EXIT_FAILURE ; } - config.pci_dev =igt_device_get_pci_device (config.fd); + config.pci_dev =intel_get_pci_device (); config.devid = config.pci_dev->device_id; }
@@ -1048,7 +1050,8 @@ int main(int argc, char *argv[])free (config.mmiofile); -close (config.fd); +if (config.fd >=0 ) +close (config.fd);return ret; }
tools/intel_reg_checker.c +1 -7
@@ -26,8 +26,6 @@#include <err.h> #include <string.h> #include <stdbool.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h"
@@ -344,12 +342,8 @@ check_dpfc_control_sa(void)int main (int argc,char ** argv) {struct pci_device *dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - dev =igt_device_get_pci_device (fd); -close (fd); + dev =intel_get_pci_device (); devid = dev->device_id;intel_mmio_use_pci_bar (dev);
tools/intel_watermark.c +9 -14
@@ -29,14 +29,12 @@#include <stdbool.h> #include <err.h> #include <string.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "drmtest.h" static uint32_t display_base;static uint32_t devid; -static int fd;static uint32_t read_reg (uint32_t addr) {
@@ -251,7 +249,7 @@ static void skl_wm_dump(void)uint32_t plane_ctl[num_pipes][max_planes];uint32_t wm_linetime[num_pipes]; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );for (pipe =0 ; pipe < num_pipes; pipe++) {int num_planes =skl_num_planes (devid, pipe);
@@ -471,7 +469,7 @@ static void ilk_wm_dump(void)int num_pipes =intel_gen (devid) >=7 ?3 :2 ;struct ilk_wm wm = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );for (i =0 ; i < num_pipes; i++) { dspcntr[i] =read_reg (0x70180 + i *0x1000 );
@@ -621,7 +619,7 @@ static void vlv_wm_dump(void)uint32_t dsp_ss_pm, ddr_setup2;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); dsparb2 =read_reg (0x70060 );
@@ -837,7 +835,7 @@ static void g4x_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dspacntr =read_reg (0x70180 ); dspbcntr =read_reg (0x71180 );
@@ -923,7 +921,7 @@ static void gen4_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );
@@ -994,7 +992,7 @@ static void pnv_wm_dump(void)uint32_t cbr;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );
@@ -1084,7 +1082,7 @@ static void gen3_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); instpm =read_reg (0x20c0 );
@@ -1153,7 +1151,7 @@ static void gen2_wm_dump(void)uint32_t mi_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); mem_mode =read_reg (0x20cc );
@@ -1228,8 +1226,7 @@ static void gen2_wm_dump(void)int main (int argc,char *argv[]) { - fd =drm_open_driver (DRIVER_INTEL ); - devid =igt_device_get_pci_device (fd)->device_id; + devid =intel_get_pci_device ()->device_id;if (intel_gen (devid) >=9 ) {skl_wm_dump ();
@@ -1253,7 +1250,5 @@ int main(int argc, char *argv[])return 1 ; } -close (fd); -return 0 ; }
Signature · 6 lines
2.19.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
== Series Details ==
== Series Details ==
Series: Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
URL : https://patchwork.freedesktop.org/series/58650/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5829 -> IGTPW_2719
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/58650/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2719 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@userptr:
- fi-kbl-8809g: PASS -> DMESG-WARN [fdo#108965]
* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]
* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: PASS -> FAIL [fdo#103167]
* igt@kms_pipe_crc_basic@read-crc-pipe-a:
- fi-byt-clapper: PASS -> FAIL [fdo#107362]
#### Possible fixes ####
* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: DMESG-FAIL [fdo#110235 ] -> PASS
* igt@i915_selftest@live_uncore:
- fi-skl-gvtdvm: DMESG-FAIL [fdo#110210] -> PASS
* igt@kms_busy@basic-flip-b:
- fi-gdg-551: FAIL [fdo#103182] -> PASS
* igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
[fdo#110210]: https://bugs.freedesktop.org/show_bug.cgi?id=110210
[fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
Participating hosts (41 -> 36)
------------------------------
Missing (5): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-bsw-cyan
Build changes
-------------
* IGT: IGT_4909 -> IGTPW_2719
CI_DRM_5829: 32a1e283d330638d2e5de8f89a9ff7c8512b75e8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2719: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2719/
IGT_4909: 7df3eeb4f3360cd2b511c31acc1c52bd7ce6587f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2719/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability.
Agreed.
Sure, add helpers to make things easier or more robust for tests in general, but do leave the pieces separate.
Quoted 1,281 lines
This reverts commit
8ae86621d6fff60b6e20c6b0f9b336785c935b0f.Cc Michał Winiarski <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- benchmarks/gem_latency.c | 4 +- benchmarks/gem_wsim.c | 4 +- debugger/debug_rdata.c | 7 +- debugger/eudb.c | 8 +-- lib/igt_device.c | 120 -------------------------------- lib/igt_device.h | 1 - lib/intel_chipset.c | 51 ++++++++++++++ lib/intel_chipset.h | 1 + lib/intel_mmio.c | 4 +- lib/ioctl_wrappers.c | 5 +- lib/ioctl_wrappers.h | 2 +- tests/i915/gem_concurrent_all.c | 12 ++-- tests/i915/gem_cpu_reloc.c | 4 +- tests/i915/gem_exec_latency.c | 3 +- tests/i915/gem_exec_parse.c | 4 +- tests/i915/gem_mmap.c | 4 +- tests/i915/gem_mmap_gtt.c | 10 +-- tests/i915/gem_pwrite.c | 4 +- tests/i915/gem_shrink.c | 2 +- tests/i915/i915_pm_lpsp.c | 3 +- tests/i915/i915_pm_rpm.c | 4 +- tests/kms_flip.c | 2 +- tests/prime_mmap.c | 4 +- tools/intel_audio_dump.c | 9 +-- tools/intel_backlight.c | 8 +-- tools/intel_display_poller.c | 8 +-- tools/intel_forcewaked.c | 10 +-- tools/intel_gpu_time.c | 8 +-- tools/intel_gtt.c | 8 +-- tools/intel_infoframes.c | 7 +- tools/intel_l3_parity.c | 3 +- tools/intel_lid.c | 9 +-- tools/intel_panel_fitter.c | 8 +-- tools/intel_perf_counters.c | 3 +- tools/intel_reg.c | 23 +++--- tools/intel_reg_checker.c | 8 +-- tools/intel_watermark.c | 23 +++--- 37 files changed, 131 insertions(+), 267 deletions(-)benchmarks/gem_latency.c +1
-3@@ -44,8 +44,6 @@#include <sys/resource.h> #include "drm.h" -#include "igt_device.h" -#define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)@@ -458,7 +456,7 @@ static int run(int seconds,if (gen <6 )return IGT_EXIT_SKIP ;/* Needs BCS timestamp */ -intel_register_access_init (igt_device_get_pci_device (fd), false, fd); +intel_register_access_init (intel_get_pci_device (), false, fd);if (gen ==6 ) timestamp_reg =REG (RCS_TIMESTAMP );benchmarks/gem_wsim.c +2
-2@@ -41,6 +41,7 @@#include <limits.h> #include <pthread.h> +#include "intel_chipset.h" #include "intel_reg.h" #include "drm.h" @@ -49,7 +50,6 @@#include "intel_io.h" #include "igt_aux.h" -#include "igt_device.h" #include "igt_rand.h" #include "igt_perf.h" #include "sw_sync.h" @@ -2223,7 +2223,7 @@ static void init_clocks(void)uint32_t rcs_start, rcs_end;double overhead, t; -intel_register_access_init (igt_device_get_pci_device (fd), false, fd); +intel_register_access_init (intel_get_pci_device (), false, fd);if (verbose <=1 )return ;debugger/debug_rdata.c +2
-5@@ -29,6 +29,7 @@#include <stdio.h> #include <stdlib.h> #include "intel_io.h" +#include "intel_chipset.h" struct eu_rdata { union {@@ -132,11 +133,7 @@ find_stuck_threads(void)int main (int argc,char *argv[]) {struct pci_device *pci_dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,1 );find_stuck_threads ();debugger/eudb.c +3
-5@@ -42,6 +42,7 @@#include "drm.h" #include "i915_drm.h" #include "drmtest.h" +#include "intel_chipset.h" #include "intel_bufmgr.h" #include "intel_io.h" #include "intel_batchbuffer.h" @@ -505,7 +506,7 @@ int main(int argc, char* argv[]) {struct pci_device *pci_dev;volatile uint8_t *scratch =NULL ;int bits[64 ]; -int devid =-1 , opt, fd; +int devid =-1 , opt;while ((opt =getopt (argc, argv,"cdr:pf?h" )) !=-1 ) {switch (opt) {@@ -532,10 +533,7 @@ int main(int argc, char* argv[]) { } } - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();if (devid ==-1 ) devid = pci_dev->device_id;if (identify_device (devid)) {lib/igt_device.c +0
-120@@ -26,7 +26,6 @@#include <sys/sysmacros.h> #include "igt.h" #include "igt_device.h" -#include "igt_sysfs.h" int __igt_device_set_master (int fd) {@@ -104,122 +103,3 @@ int igt_device_get_card_index(int fd)return minor (st.st_rdev); } - -#define IGT_DEV_PATH_LEN 80 - -static bool igt_device_is_pci (int fd) -{ -char path[IGT_DEV_PATH_LEN ]; -char *subsystem; -int sysfs; -int len; - - sysfs =igt_sysfs_open (fd); -if (sysfs ==-1 ) -return false; - - len =readlinkat (sysfs,"device/subsystem" , path,sizeof (path) -1 ); -if (len ==-1 ) -return false; - path[len] ='\0' ; - - subsystem =strrchr (path,'/' ); -if (!subsystem) -return false; - -return strcmp (subsystem,"/pci" ) ==0 ; -} - -struct igt_pci_addr { -unsigned int domain; -unsigned int bus; -unsigned int device; -unsigned int function; -}; - -static int igt_device_get_pci_addr (int fd,struct igt_pci_addr *pci) -{ -char path[IGT_DEV_PATH_LEN ]; -char *buf; -int sysfs; -int len; - -if (!igt_device_is_pci (fd)) -return -ENODEV ; - - sysfs =igt_sysfs_open (fd); -if (sysfs ==-1 ) -return -ENOENT ; - - len =readlinkat (sysfs,"device" , path,sizeof (path) -1 ); -if (len ==-1 ) -return -ENOENT ; - path[len] ='\0' ; - - buf =strrchr (path,'/' ); -if (!buf) -return -ENOENT ; - -if (sscanf (buf,"/%4x:%2x:%2x.%2x" , - &pci->domain, &pci->bus, - &pci->device, &pci->function) !=4 ) { -igt_warn ("Unable to extract PCI device address from '%s'\n" , buf); -return -ENOENT ; - } - -return 0 ; -} - -static struct pci_device *__igt_device_get_pci_device (int fd) -{ -struct igt_pci_addr pci_addr; -struct pci_device *pci_dev; - -if (igt_device_get_pci_addr (fd, &pci_addr)) { -igt_warn ("Unable to find device PCI address\n" ); -return NULL ; - } - -if (pci_system_init ()) { -igt_warn ("Couldn't initialize PCI system\n" ); -return NULL ; - } - - pci_dev =pci_device_find_by_slot (pci_addr.domain, - pci_addr.bus, - pci_addr.device, - pci_addr.function); -if (!pci_dev) { -igt_warn ("Couldn't find PCI device %04x:%02x:%02x:%02x\n" , - pci_addr.domain, pci_addr.bus, - pci_addr.device, pci_addr.function); -return NULL ; - } - -if (pci_device_probe (pci_dev)) { -igt_warn ("Couldn't probe PCI device\n" ); -return NULL ; - } - -return pci_dev; -} - -/** -* igt_device_get_pci_device: -* -* @fd: the device -* -* Looks up the main graphics pci device using libpciaccess. -* -* Returns: -* The pci_device, skips the test on any failures. -*/ -struct pci_device *igt_device_get_pci_device (int fd) -{ -struct pci_device *pci_dev; - - pci_dev =__igt_device_get_pci_device (fd); -igt_require (pci_dev); - -return pci_dev; -}lib/igt_device.h +0
-1@@ -32,6 +32,5 @@ int __igt_device_drop_master(int fd);void igt_device_drop_master (int fd);int igt_device_get_card_index (int fd); -struct pci_device *igt_device_get_pci_device (int fd);#endif /* __IGT_DEVICE_H__ */ lib/intel_chipset.c +51
-0@@ -61,6 +61,57 @@*/ enum pch_type intel_pch; +/** +* intel_get_pci_device: +* +* Looks up the main graphics pci device using libpciaccess. +* +* Returns: +* The pci_device, exits the program on any failures. +*/ +struct pci_device * +intel_get_pci_device (void ) +{ +struct pci_device *pci_dev; +int error; + + error =pci_system_init (); +igt_fail_on_f (error !=0 , +"Couldn't initialize PCI system\n" ); + +/* Grab the graphics card. Try the canonical slot first, then +* walk the entire PCI bus for a matching device. */ + pci_dev =pci_device_find_by_slot (0 ,0 ,2 ,0 ); +if (pci_dev ==NULL || pci_dev->vendor_id !=0x8086 ) { +struct pci_device_iterator *iter; +struct pci_id_match match; + + match.vendor_id =0x8086 ;/* Intel */ + match.device_id =PCI_MATCH_ANY ; + match.subvendor_id =PCI_MATCH_ANY ; + match.subdevice_id =PCI_MATCH_ANY ; + + match.device_class =0x3 <<16 ; + match.device_class_mask =0xff <<16 ; + + match.match_data =0 ; + + iter =pci_id_match_iterator_create (&match); + pci_dev =pci_device_next (iter); +pci_iterator_destroy (iter); + } +igt_require_f (pci_dev,"Couldn't find Intel graphics card\n" ); + + error =pci_device_probe (pci_dev); +igt_fail_on_f (error !=0 , +"Couldn't probe graphics card\n" ); + +if (pci_dev->vendor_id !=0x8086 ) +errx (1 ,"Graphics card is non-intel" ); + +return pci_dev; +} +/** * intel_get_drm_devid: * @fd: open i915 drm file descriptor lib/intel_chipset.h +1
-0@@ -31,6 +31,7 @@#include <pciaccess.h> #include <stdbool.h> +struct pci_device *intel_get_pci_device (void );uint32_t intel_get_drm_devid (int fd);struct intel_device_info {lib/intel_mmio.c +2
-2@@ -112,7 +112,7 @@ intel_mmio_use_dump_file(char *file)* * Sets up #igt_global_mmio to point at the mmio bar. * -* @pci_dev can be obtained from igt_device_get_pci_device(). +* @pci_dev can be obtained from intel_get_pci_device(). */ void intel_mmio_use_pci_bar (struct pci_device *pci_dev)@@ -162,7 +162,7 @@ release_forcewake_lock(int fd)* * It also initializes #igt_global_mmio like intel_mmio_use_pci_bar(). * -* @pci_dev can be obtained from igt_device_get_pci_device(). +* @pci_dev can be obtained from intel_get_pci_device(). */ int intel_register_access_init (struct pci_device *pci_dev,int safe,int fd)lib/ioctl_wrappers.c +2
-3@@ -53,7 +53,6 @@#include "intel_chipset.h" #include "intel_io.h" #include "igt_debugfs.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "config.h" @@ -1097,9 +1096,9 @@ uint64_t gem_aperture_size(int fd)* * Returns: The mappable gtt address space size. */ -uint64_t gem_mappable_aperture_size (int fd) +uint64_t gem_mappable_aperture_size (void ) { -struct pci_device *pci_dev =igt_device_get_pci_device (fd); +struct pci_device *pci_dev =intel_get_pci_device ();int bar;if (intel_gen (pci_dev->device_id) <3 )lib/ioctl_wrappers.h +1
-1@@ -136,7 +136,7 @@ uint64_t gem_total_stolen_size(int fd);uint64_t gem_available_aperture_size (int fd);uint64_t gem_aperture_size (int fd);uint64_t gem_global_aperture_size (int fd); -uint64_t gem_mappable_aperture_size (int fd); +uint64_t gem_mappable_aperture_size (void );bool gem_has_softpin (int fd);bool gem_has_exec_fence (int fd);tests/i915/gem_concurrent_all.c +6
-6@@ -1850,7 +1850,7 @@ igt_main c->name, s->name, "small"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd)/4 , + count =num_buffers (gem_mappable_aperture_size ()/4 , s, c,CHECK_RAM ); }run_modes (name, c, modes, s, count);@@ -1861,7 +1861,7 @@ igt_main c->name, s->name, "thrash"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM ); }run_modes (name, c, modes, s, count);@@ -1893,7 +1893,7 @@ igt_main c->name, s->name, "shrink"); igt_subtest_group { igt_fixture { - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM );igt_fork_shrink_helper (fd);@@ -1909,8 +1909,8 @@ igt_main c->name, s->name, "swap"); igt_subtest_group { igt_fixture { -if (intel_get_avail_ram_mb () >gem_mappable_aperture_size (fd)/(1024 *1024 )) { - pin_sz =intel_get_avail_ram_mb () -gem_mappable_aperture_size (fd)/(1024 *1024 ); +if (intel_get_avail_ram_mb () >gem_mappable_aperture_size ()/(1024 *1024 )) { + pin_sz =intel_get_avail_ram_mb () -gem_mappable_aperture_size ()/(1024 *1024 );igt_debug ("Pinning %lld MiB\n" , (long long )pin_sz); pin_sz *=1024 *1024 ;@@ -1924,7 +1924,7 @@ igt_mainigt_require (pinned); } - count =num_buffers (gem_mappable_aperture_size (fd), + count =num_buffers (gem_mappable_aperture_size (), s, c,CHECK_RAM |CHECK_SWAP ); }run_modes (name, c, modes, s, count);tests/i915/gem_cpu_reloc.c +2
-2@@ -283,7 +283,7 @@ igt_mainrun_test (i915,1 ); igt_subtest("full") { -uint64_t aper_size =gem_mappable_aperture_size (i915); +uint64_t aper_size =gem_mappable_aperture_size ();unsigned long count = aper_size /4096 +1 ;intel_require_memory (count,4096 ,CHECK_RAM );@@ -292,7 +292,7 @@ igt_main } igt_subtest("forked") { -uint64_t aper_size =gem_mappable_aperture_size (i915); +uint64_t aper_size =gem_mappable_aperture_size ();unsigned long count = aper_size /4096 +1 ;int ncpus =sysconf (_SC_NPROCESSORS_ONLN);tests/i915/gem_exec_latency.c +1
-2@@ -40,7 +40,6 @@#include "drm.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "igt_vgem.h" #include "igt_dummyload.h" @@ -680,7 +679,7 @@ igt_mainif (ring_size >1024 ) ring_size =1024 ; -intel_register_access_init (igt_device_get_pci_device (device), false, device); +intel_register_access_init (intel_get_pci_device (), false, device); rcs_clock =clockrate (device,RCS_TIMESTAMP );igt_info ("RCS timestamp clock: %.0fKHz, %.1fns\n" , rcs_clock /1e3 ,1e9 / rcs_clock);tests/i915/gem_exec_parse.c +1
-3@@ -30,8 +30,6 @@#include <drm.h> -#include "igt_device.h" -#ifndef I915_PARAM_CMD_PARSER_VERSION #define I915_PARAM_CMD_PARSER_VERSION 28#endif @@ -532,7 +530,7 @@ igt_main#undef REG igt_fixture { -intel_register_access_init (igt_device_get_pci_device (fd),0 , fd); +intel_register_access_init (intel_get_pci_device (),0 , fd); }for (int i =0 ; i <ARRAY_SIZE (lris); i++) {tests/i915/gem_mmap.c +2
-2@@ -53,10 +53,10 @@ test_huge_bo(int huge)switch (huge) {case -1 : - huge_object_size =gem_mappable_aperture_size (fd) /2 ; + huge_object_size =gem_mappable_aperture_size () /2 ;break ;case 0 : - huge_object_size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + huge_object_size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;case 1 : huge_object_size =gem_aperture_size (fd) +PAGE_SIZE ;tests/i915/gem_mmap_gtt.c +5
-5@@ -562,7 +562,7 @@ test_huge_bo(int fd, int huge, int tiling)switch (huge) {case -1 : - size =gem_mappable_aperture_size (fd) /2 ; + size =gem_mappable_aperture_size () /2 ;/* Power of two fence size, natural fence * alignment, and the guard page at the end @@ -577,7 +577,7 @@ test_huge_bo(int fd, int huge, int tiling) size /=2 ;break ;case 0 : - size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;default : size =gem_global_aperture_size (fd) +PAGE_SIZE ;@@ -658,13 +658,13 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b, int ncpus)switch (huge) {case -2 : - huge_object_size =gem_mappable_aperture_size (fd) /4 ; + huge_object_size =gem_mappable_aperture_size () /4 ;break ;case -1 : - huge_object_size =gem_mappable_aperture_size (fd) /2 ; + huge_object_size =gem_mappable_aperture_size () /2 ;break ;case 0 : - huge_object_size =gem_mappable_aperture_size (fd) +PAGE_SIZE ; + huge_object_size =gem_mappable_aperture_size () +PAGE_SIZE ;break ;case 1 : huge_object_size =gem_global_aperture_size (fd) +PAGE_SIZE ;tests/i915/gem_pwrite.c +2
-2@@ -89,7 +89,7 @@ static void test_big_cpu(int fd, int scale, unsigned flags)switch (scale) {case 0 : - size =gem_mappable_aperture_size (fd) +4096 ; + size =gem_mappable_aperture_size () +4096 ;break ;case 1 : size =gem_global_aperture_size (fd) +4096 ;@@ -151,7 +151,7 @@ static void test_big_gtt(int fd, int scale, unsigned flags)igt_require (gem_mmap__has_wc (fd));switch (scale) {case 0 : - size =gem_mappable_aperture_size (fd) +4096 ; + size =gem_mappable_aperture_size () +4096 ;break ;case 1 : size =gem_global_aperture_size (fd) +4096 ;tests/i915/gem_shrink.c +1
-1@@ -413,7 +413,7 @@ igt_main* we expect the shrinker to start purging objects, * and possibly fail. */ - alloc_size =gem_mappable_aperture_size (fd) /2 ; + alloc_size =gem_mappable_aperture_size () /2 ; num_processes =1 + (mem_size / (alloc_size >>20 )); igt_info("Using %d processes and %'lluMiB per process\n",tests/i915/i915_pm_lpsp.c +1
-2@@ -30,7 +30,6 @@#include <fcntl.h> #include <unistd.h> -#include "igt_device.h" static bool supports_lpsp (uint32_t devid) {@@ -211,7 +210,7 @@ igt_mainigt_require (supports_lpsp (devid)); -intel_register_access_init (igt_device_get_pci_device (drm_fd),0 , drm_fd); +intel_register_access_init (intel_get_pci_device (),0 , drm_fd);kmstest_set_vt_graphics_mode (); }tests/i915/i915_pm_rpm.c +2
-2@@ -1368,7 +1368,7 @@ static void gem_evict_pwrite_subtest(void)unsigned int num_trash_bos, n;uint32_t buf; - num_trash_bos =gem_mappable_aperture_size (drm_fd) / (1024 *1024 ) +1 ; + num_trash_bos =gem_mappable_aperture_size () / (1024 *1024 ) +1 ; trash_bos =malloc (num_trash_bos *sizeof (*trash_bos));igt_assert (trash_bos);@@ -1412,7 +1412,7 @@ static bool device_in_pci_d3(void)uint16_t val;int rc; - rc =pci_device_cfg_read_u16 (igt_device_get_pci_device (drm_fd), &val,0xd4 ); + rc =pci_device_cfg_read_u16 (intel_get_pci_device (), &val,0xd4 );igt_assert_eq (rc,0 );igt_debug ("%s: PCI D3 state=%d\n" , __func__, val &0x3 );tests/kms_flip.c +1
-1@@ -1224,7 +1224,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,/* 256 MB is usually the maximum mappable aperture, * (make it 4x times that to ensure failure) */ if (o->flags &TEST_BO_TOOBIG ) { - bo_size =4 *gem_mappable_aperture_size (drm_fd); + bo_size =4 *gem_mappable_aperture_size ();igt_require (bo_size <gem_global_aperture_size (drm_fd)); }tests/prime_mmap.c +2
-2@@ -447,8 +447,8 @@ test_aperture_limit(void)char *ptr1, *ptr2;uint32_t handle1, handle2;/* Two buffers the sum of which > mappable aperture */ -uint64_t size1 = (gem_mappable_aperture_size (fd) *7 ) /8 ; -uint64_t size2 = (gem_mappable_aperture_size (fd) *3 ) /8 ; +uint64_t size1 = (gem_mappable_aperture_size () *7 ) /8 ; +uint64_t size2 = (gem_mappable_aperture_size () *3 ) /8 ; handle1 =gem_create (fd, size1);fill_bo (handle1,BO_SIZE );tools/intel_audio_dump.c +1
-8@@ -32,7 +32,6 @@#include <string.h> #include <err.h> #include <arpa/inet.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_reg.h" #include "intel_chipset.h" @@ -2465,12 +2464,8 @@ static void dump_braswell(void)int main (int argc,char **argv) {struct pci_device *pci_dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); + pci_dev =intel_get_pci_device (); devid = pci_dev->device_id;/* XXX not true when mapping! */ do_self_tests ();@@ -2498,7 +2493,5 @@ int main(int argc, char **argv)dump_eaglelake (); } -close (fd); -return 0 ; }tools/intel_backlight.c +2
-6@@ -30,9 +30,8 @@#include <stdio.h> #include <string.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg.h" /* XXX PCH only today */ @@ -40,11 +39,8 @@int main (int argc,char ** argv) {uint32_t current, max; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ()); current =INREG (BLC_PWM_CPU_CTL ) &BACKLIGHT_DUTY_CYCLE_MASK ; max =INREG (BLC_PWM_PCH_CTL2 ) >>16 ;tools/intel_display_poller.c +2
-6@@ -36,7 +36,6 @@#include "intel_io.h" #include "intel_reg.h" #include "igt_debugfs.h" -#include "igt_device.h" #include "drmtest.h" #include "igt_aux.h" @@ -972,7 +971,6 @@ int main(int argc, char *argv[])uint32_t a, b;enum test test =TEST_INVALID ;const int count =ARRAY_SIZE (min)/2 ; -int fd;for (;;) {static const struct option long_options[] = {@@ -1048,8 +1046,7 @@ int main(int argc, char *argv[]) } } - fd =drm_open_driver (DRIVER_INTEL ); - devid =igt_device_get_pci_device (fd)->device_id; + devid =intel_get_pci_device ()->device_id;/* * check if the requires registers are @@ -1190,7 +1187,7 @@ int main(int argc, char *argv[])break ; } -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );printf ("%s?\n" ,test_name (test, pipe, bit, test_pixelcount));@@ -1266,7 +1263,6 @@ int main(int argc, char *argv[]) }intel_register_access_fini (); -close (fd);if (quit)return 0 ;tools/intel_forcewaked.c +3
-7@@ -34,8 +34,8 @@#include <stdlib.h> #include <syslog.h> #include <unistd.h> -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "drmtest.h" bool daemonized;@@ -65,7 +65,6 @@ is_alive(void) {int main (int argc,char *argv[]) {int ret; -int fd;if (argc >2 || (argc ==2 && !strncmp (argv[1 ],"-h" ,2 ))) {help (argv[1 ]);@@ -81,27 +80,24 @@ int main(int argc, char *argv[])INFO_PRINT ("started daemon" ); } - fd =drm_open_driver (DRIVER_INTEL ); - ret =intel_register_access_init (igt_device_get_pci_device (fd),1 ,-1 ); + ret =intel_register_access_init (intel_get_pci_device (),1 ,-1 );if (ret) {INFO_PRINT ("Couldn't init register access\n" );exit (1 ); }else {INFO_PRINT ("Forcewake locked\n" ); } -while (1 ) {if (!is_alive ()) {INFO_PRINT ("gpu reset? restarting daemon\n" );intel_register_access_fini (); - ret =intel_register_access_init (igt_device_get_pci_device (fd),1 ,-1 ); + 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 (fd);INFO_PRINT ("Forcewake unlock\n" );if (daemonized) {tools/intel_gpu_time.c +2
-6@@ -34,9 +34,8 @@#include <sys/resource.h> #include <sys/wait.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg.h" #define SAMPLES_PER_SEC 10000@@ -67,11 +66,8 @@ int main(int argc, char **argv)struct timeval start, end;static struct rusage rusage;int status; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ());if (argc ==1 ) {fprintf (stderr,"usage: %s cmd [args...]\n" , argv[0 ]);tools/intel_gtt.c +1
-7@@ -34,8 +34,6 @@#include <pciaccess.h> #include <unistd.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" @@ -142,17 +140,13 @@ int main(int argc, char **argv) {struct pci_device *pci_dev;unsigned int start, gtt_size; -int fd;int flag[] = {PCI_DEV_MAP_FLAG_WRITE_COMBINE ,PCI_DEV_MAP_FLAG_WRITABLE ,0 }, f; - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device (); devid = pci_dev->device_id;if (IS_GEN2 (devid)) {tools/intel_infoframes.c +1
-6@@ -30,7 +30,6 @@#include <stdlib.h> #include <string.h> #include <getopt.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "drmtest.h" @@ -1082,7 +1081,6 @@ printf("Options:\n"int main (int argc,char *argv[]) {int opt; -int fd;int ret =0 ;Transcoder transcoder =TRANSC_INVALID ;DipType dip =DIP_INVALID ;@@ -1109,10 +1107,7 @@ 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" ); - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,0 ,-1 );intel_check_pch ();tools/intel_l3_parity.c +1
-2@@ -36,7 +36,6 @@#include <getopt.h> #include "intel_chipset.h" #include "intel_io.h" -#include "igt_device.h" #include "igt_sysfs.h" #include "drmtest.h" #include "config.h" @@ -190,7 +189,7 @@ int main(int argc, char *argv[])if (intel_gen (devid) <7 ||IS_VALLEYVIEW (devid))exit (77 ); -assert (intel_register_access_init (igt_device_get_pci_device (device),0 , device) ==0 ); +assert (intel_register_access_init (intel_get_pci_device (),0 , device) ==0 ); dir =igt_sysfs_open (device);tools/intel_lid.c +2
-7@@ -37,10 +37,9 @@#include <sys/stat.h> #include <sys/types.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_reg.h" +#include "intel_chipset.h" #define SWF14_LID_STATUS_CLOSED (1<<29)/* 0 here means open */ @@ -119,11 +118,8 @@ out:int main (int argc,char **argv) {int swf14, acpi_lid; -int fd; - fd =drm_open_driver (DRIVER_INTEL ); -intel_mmio_use_pci_bar (igt_device_get_pci_device (fd)); -close (fd); +intel_mmio_use_pci_bar (intel_get_pci_device ());while (1 ) { swf14 =INREG (SWF14 );@@ -146,6 +142,5 @@ int main(int argc, char **argv) }sleep (2 ); } -return 0 ; }tools/intel_panel_fitter.c +1
-7@@ -30,7 +30,6 @@#include <unistd.h> #include <stdlib.h> #include <string.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "intel_reg.h" @@ -274,17 +273,13 @@ int main (int argc, char *argv[])bool do_disable = false, do_dump = false, do_usage = false;struct pci_device *pci_dev;uint32_t devid; -int fd;printf ("WARNING:\n" "This tool is a workaround for people that don't have a Kernel " "with overscan compensation properties: it is just a temporary " "solution that may or may not work. Use it at your own risk.\n" ); - fd =drm_open_driver (DRIVER_INTEL ); - pci_dev =igt_device_get_pci_device (fd); -close (fd); - + pci_dev =intel_get_pci_device ();intel_register_access_init (pci_dev,0 ,-1 ); devid = pci_dev->device_id;@@ -348,6 +343,5 @@ int main (int argc, char *argv[]) out:intel_register_access_fini (); -return ret; }tools/intel_perf_counters.c +1
-2@@ -45,7 +45,6 @@#include "drm.h" #include "i915_drm.h" #include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" @@ -484,7 +483,7 @@ main(int argc, char **argv)if (oacontrol) {/* Forcewake */ -intel_register_access_init (igt_device_get_pci_device (fd),0 , fd); +intel_register_access_init (intel_get_pci_device (),0 , fd);/* Enable performance counters */ intel_register_write(OACONTROL,tools/intel_reg.c +13
-10@@ -33,9 +33,9 @@#include <unistd.h> #include "igt.h" -#include "igt_device.h" #include "igt_gt.h" #include "intel_io.h" +#include "intel_chipset.h" #include "intel_reg_spec.h" @@ -274,6 +274,15 @@ static int register_srm(struct config *config, struct reg *reg,int fd, i;uint32_t val; +if (config->fd ==-1 ) { + config->fd =__drm_open_driver (DRIVER_INTEL ); +if (config->fd ==-1 ) { +fprintf (stderr,"Error opening driver: %s" , +strerror (errno)); +exit (EXIT_FAILURE ); + } + } + fd = config->fd; engine =find_engine (reg->engine);if (engine ==NULL )@@ -1006,13 +1015,6 @@ int main(int argc, char *argv[])return EXIT_FAILURE ; } - config.fd =__drm_open_driver (DRIVER_INTEL ); -if (config.fd ==-1 ) { -fprintf (stderr,"Error opening driver: %s" , -strerror (errno)); -exit (EXIT_FAILURE ); - } -if (config.mmiofile) {if (!config.devid) {fprintf (stderr,"--mmio requires --devid\n" );@@ -1024,7 +1026,7 @@ int main(int argc, char *argv[])fprintf (stderr,"--devid without --mmio\n" );return EXIT_FAILURE ; } - config.pci_dev =igt_device_get_pci_device (config.fd); + config.pci_dev =intel_get_pci_device (); config.devid = config.pci_dev->device_id; }@@ -1048,7 +1050,8 @@ int main(int argc, char *argv[])free (config.mmiofile); -close (config.fd); +if (config.fd >=0 ) +close (config.fd);return ret; }tools/intel_reg_checker.c +1
-7@@ -26,8 +26,6 @@#include <err.h> #include <string.h> #include <stdbool.h> -#include "drmtest.h" -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" @@ -344,12 +342,8 @@ check_dpfc_control_sa(void)int main (int argc,char ** argv) {struct pci_device *dev; -int fd; - - fd =drm_open_driver (DRIVER_INTEL ); - dev =igt_device_get_pci_device (fd); -close (fd); + dev =intel_get_pci_device (); devid = dev->device_id;intel_mmio_use_pci_bar (dev);tools/intel_watermark.c +9
-14@@ -29,14 +29,12 @@#include <stdbool.h> #include <err.h> #include <string.h> -#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" #include "drmtest.h" static uint32_t display_base;static uint32_t devid; -static int fd;static uint32_t read_reg (uint32_t addr) {@@ -251,7 +249,7 @@ static void skl_wm_dump(void)uint32_t plane_ctl[num_pipes][max_planes];uint32_t wm_linetime[num_pipes]; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );for (pipe =0 ; pipe < num_pipes; pipe++) {int num_planes =skl_num_planes (devid, pipe);@@ -471,7 +469,7 @@ static void ilk_wm_dump(void)int num_pipes =intel_gen (devid) >=7 ?3 :2 ;struct ilk_wm wm = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 );for (i =0 ; i < num_pipes; i++) { dspcntr[i] =read_reg (0x70180 + i *0x1000 );@@ -621,7 +619,7 @@ static void vlv_wm_dump(void)uint32_t dsp_ss_pm, ddr_setup2;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); dsparb2 =read_reg (0x70060 );@@ -837,7 +835,7 @@ static void g4x_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dspacntr =read_reg (0x70180 ); dspbcntr =read_reg (0x71180 );@@ -923,7 +921,7 @@ static void gen4_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );@@ -994,7 +992,7 @@ static void pnv_wm_dump(void)uint32_t cbr;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );@@ -1084,7 +1082,7 @@ static void gen3_wm_dump(void)uint32_t mi_arb_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); instpm =read_reg (0x20c0 );@@ -1153,7 +1151,7 @@ static void gen2_wm_dump(void)uint32_t mi_state;struct gmch_wm wms[MAX_PLANE ] = {}; -intel_register_access_init (igt_device_get_pci_device (fd),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 ); dsparb =read_reg (0x70030 ); mem_mode =read_reg (0x20cc );@@ -1228,8 +1226,7 @@ static void gen2_wm_dump(void)int main (int argc,char *argv[]) { - fd =drm_open_driver (DRIVER_INTEL ); - devid =igt_device_get_pci_device (fd)->device_id; + devid =intel_get_pci_device ()->device_id;if (intel_gen (devid) >=9 ) {skl_wm_dump ();@@ -1253,7 +1250,5 @@ int main(int argc, char *argv[])return 1 ; } -close (fd); -return 0 ; }
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Jani Nikula (2019-03-28 08:14:02)
Quoted 8 lines · Ville Syrjala
Quoted 5 lines
From: Ville Syrjälä <[email protected]>
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability.
Agreed.
Not quite, I see the problem of tools/ linking against the libigt.la smorgasbord remaining.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 4 lines · Chris Wilson
Quoting Jani Nikula (2019-03-28 08:14:02)
Quoted 3 lines · Ville Syrjala
Quoted 2 lines
From: Ville Syrjälä <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability.
Agreed.
Not quite, I see the problem of
tools/linking against the libigt.la smorgasbord remaining.
Well, agreed on the revert as stopgap because it breaks an important use case.
I wrote and deleted some musings on how I think tools/ is increasingly out of place in igt. The common igt code evolves from tests/ perspective, and I suppose rightly so. I think I've suggested in the past tools/ should be split out to be more independent, either within igt repo or in a separate project/repo of its own.
If tools/ remain in igt, perhaps we need a lower level no-nonsense lib that doesn't, for example, do stack unwind on errors which is rather silly with the general purpose tools. And then have a tests lib on top for tests.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
One significant usecase for intel_reg/etc. is to be able to examine the hardware state *before* loading the driver. If the tool forces the driver to load we've totally lost that capability.
This reverts commit
8ae86621d6fff60b6e20c6b0f9b336785c935b0f.Cc Michał Winiarski <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
I still think it was a small step in the right direction, but if it breaks your usecase:
(I'm not giving up on killing intel_get_pci_device from the tests, so expect a revert-revert ;) )
-Michał
Quoted 31 lines
--- benchmarks/gem_latency.c | 4 +- benchmarks/gem_wsim.c | 4 +- debugger/debug_rdata.c | 7 +- debugger/eudb.c | 8 +-- lib/igt_device.c | 120 -------------------------------- lib/igt_device.h | 1 - lib/intel_chipset.c | 51 ++++++++++++++ lib/intel_chipset.h | 1 + lib/intel_mmio.c | 4 +- lib/ioctl_wrappers.c | 5 +- lib/ioctl_wrappers.h | 2 +- tests/i915/gem_concurrent_all.c | 12 ++-- tests/i915/gem_cpu_reloc.c | 4 +- tests/i915/gem_exec_latency.c | 3 +- tests/i915/gem_exec_parse.c | 4 +- tests/i915/gem_mmap.c | 4 +- tests/i915/gem_mmap_gtt.c | 10 +-- tests/i915/gem_pwrite.c | 4 +- tests/i915/gem_shrink.c | 2 +- tests/i915/i915_pm_lpsp.c | 3 +- tests/i915/i915_pm_rpm.c | 4 +- tests/kms_flip.c | 2 +- tests/prime_mmap.c | 4 +- tools/intel_audio_dump.c | 9 +-- tools/intel_backlight.c | 8 +-- tools/intel_display_poller.c | 8 +-- tools/intel_forcewaked.c | 10 +-- tools/intel_gpu_time.c | 8 +-- tools/intel_gtt.c | 8 +-- tools/intel_infoframes.c | 7 +-
Quoted 8 lines
tools/intel_l3_parity.c | 3 +- tools/intel_lid.c | 9 +-- tools/intel_panel_fitter.c | 8 +-- tools/intel_perf_counters.c | 3 +- tools/intel_reg.c | 23 +++--- tools/intel_reg_checker.c | 8 +-- tools/intel_watermark.c | 23 +++--- 37 files changed, 131 insertions(+), 267 deletions(-)
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: Revert "lib/igt_device: Move intel_get_pci_device under igt_device"
URL : https://patchwork.freedesktop.org/series/58650/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5829_full -> IGTPW_2719_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/58650/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2719_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_schedule@fifo-bsd2:
- shard-snb: NOTRUN -> SKIP [fdo#109271] +68
* igt@gem_pwrite@stolen-normal:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +19
* igt@gem_tiled_swapping@non-threaded:
- shard-hsw: PASS -> INCOMPLETE [fdo#103540]
* igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
- shard-apl: PASS -> INCOMPLETE [fdo#103927] +1
* igt@kms_busy@extended-modeset-hang-newfb-render-c:
- shard-kbl: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-modeset-hang-oldfb-with-reset-render-f:
- shard-glk: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_busy@extended-pageflip-hang-newfb-render-a:
- shard-glk: NOTRUN -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
- shard-glk: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-kbl: PASS -> FAIL [fdo#103191] / [fdo#103232]
- shard-apl: PASS -> FAIL [fdo#103191] / [fdo#103232]
* igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions:
- shard-hsw: PASS -> FAIL [fdo#103355]
* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk: PASS -> FAIL [fdo#105363]
* igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-shrfb-draw-pwrite:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +4
* igt@kms_frontbuffer_tracking@psr-2p-scndscrn-shrfb-msflip-blt:
- shard-glk: NOTRUN -> SKIP [fdo#109271] +17
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-d:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1
* igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
- shard-apl: NOTRUN -> FAIL [fdo#108145]
- shard-glk: NOTRUN -> FAIL [fdo#108145] +1
* igt@kms_plane_scaling@pipe-a-scaler-with-clipping-clamping:
- shard-glk: PASS -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_universal_plane@universal-plane-gen9-features-pipe-e:
- shard-snb: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +6
* igt@kms_vblank@pipe-a-ts-continuation-modeset-rpm:
- shard-apl: PASS -> FAIL [fdo#104894]
* igt@testdisplay:
- shard-kbl: PASS -> INCOMPLETE [fdo#103665] +2
#### Possible fixes ####
* igt@gem_eio@in-flight-suspend:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS
* igt@i915_pm_rc6_residency@rc6-accuracy:
- shard-snb: SKIP [fdo#109271] -> PASS
* igt@kms_cursor_crc@cursor-256x256-random:
- shard-glk: FAIL [fdo#103232] -> PASS
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-glk: FAIL [fdo#103167] -> PASS
- shard-kbl: FAIL [fdo#103167] -> PASS
- shard-apl: FAIL [fdo#103167] -> PASS * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-apl: FAIL [fdo#108145] -> PASS +1
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: FAIL [fdo#108145] -> PASS +1
- shard-kbl: FAIL [fdo#108145] -> PASS +1
* igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-kbl: DMESG-FAIL [fdo#105763] -> PASS
* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS
* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: FAIL [fdo#104894] -> PASS
- shard-kbl: FAIL [fdo#104894] -> PASS
#### Warnings ####
* igt@runner@aborted:
- shard-glk: ( 2 FAIL ) [fdo#109373] / [k.org#202321] -> FAIL [fdo#109373] / [k.org#202321]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109373]: https://bugs.freedesktop.org/show_bug.cgi?id=109373
[fdo#110222]: https://bugs.freedesktop.org/show_bug.cgi?id=110222
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
Participating hosts (10 -> 5)
------------------------------
Missing (5): shard-skl pig-hsw-4770r pig-glk-j5005 shard-iclb pig-skl-6260u
Build changes
-------------
* IGT: IGT_4909 -> IGTPW_2719
* Piglit: piglit_4509 -> None
CI_DRM_5829: 32a1e283d330638d2e5de8f89a9ff7c8512b75e8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2719: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2719/
IGT_4909: 7df3eeb4f3360cd2b511c31acc1c52bd7ce6587f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2719/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev