Re: [Intel-gfx] [PATCH] quick_dump: Fix the danvet fallout.

2014-03-25 Thread Ben Widawsky
On Tue, Mar 25, 2014 at 08:47:47PM +0100, Daniel Vetter wrote:
> On Tue, Mar 25, 2014 at 11:38:51AM -0700, Ben Widawsky wrote:
> > quick_dump built fine, but it could actually run, since a lot of the
> > linking happens at run time. There is one hack where we redefine the
> > environment stuff, since depending on igt_aux means we have to pull in
> > libdrm, which I do not want to do.
> 
> Why? libdrm is kinda something we need anyway ...
> -Daniel

The goal is to keep the dumper's dependencies and functionality to a
bare minimum. We absolutely should not need libdrm for register dumps.
If you want to do fancy stuff post process that requires libdrm, that's
another thing.

> 
> > 
> > Cc: Ville Syrjälä 
> > Signed-off-by: Ben Widawsky 
> > ---
> >  tools/quick_dump/Makefile.am  |  2 ++
> >  tools/quick_dump/chipset.i|  5 +++--
> >  tools/quick_dump/chipset_macro_wrap.c | 14 ++
> >  3 files changed, 19 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
> > index 7572ee5..ca26993 100644
> > --- a/tools/quick_dump/Makefile.am
> > +++ b/tools/quick_dump/Makefile.am
> > @@ -8,6 +8,8 @@ bin_SCRIPTS = chipset.py
> >  lib_LTLIBRARIES = I915ChipsetPython.la
> >  I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 
> > $(PCIACCESS_LIBS)
> >  I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
> > +  $(top_srcdir)/lib/igt_core.c  \
> > +  $(top_srcdir)/lib/igt_debugfs.c  \
> >$(top_srcdir)/lib/intel_os.c  \
> >$(top_srcdir)/lib/intel_chipset.c  \
> >$(top_srcdir)/lib/intel_reg_map.c  \
> > diff --git a/tools/quick_dump/chipset.i b/tools/quick_dump/chipset.i
> > index 395418e..ae176e8 100644
> > --- a/tools/quick_dump/chipset.i
> > +++ b/tools/quick_dump/chipset.i
> > @@ -4,6 +4,7 @@
> >  #include 
> >  #include 
> >  #include "intel_chipset.h"
> > +#include "intel_io.h"
> >  extern int is_sandybridge(unsigned short pciid);
> >  extern int is_ivybridge(unsigned short pciid);
> >  extern int is_valleyview(unsigned short pciid);
> > @@ -12,7 +13,7 @@ extern int is_broadwell(unsigned short pciid);
> >  extern struct pci_device *intel_get_pci_device();
> >  extern int intel_register_access_init(struct pci_device *pci_dev, int 
> > safe);
> >  extern uint32_t intel_register_read(uint32_t reg);
> > -extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
> > +extern void intel_register_write(uint32_t reg, uint32_t val);
> >  extern void intel_register_access_fini();
> >  extern int intel_register_access_needs_fakewake();
> >  extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
> > @@ -27,7 +28,7 @@ extern int is_broadwell(unsigned short pciid);
> >  extern struct pci_device *intel_get_pci_device();
> >  extern int intel_register_access_init(struct pci_device *pci_dev, int 
> > safe);
> >  extern uint32_t intel_register_read(uint32_t reg);
> > -extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
> > +extern void intel_register_write(uint32_t reg, uint32_t val);
> >  extern void intel_register_access_fini();
> >  extern int intel_register_access_needs_fakewake();
> >  extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
> > diff --git a/tools/quick_dump/chipset_macro_wrap.c 
> > b/tools/quick_dump/chipset_macro_wrap.c
> > index 392b85e..ee79777 100644
> > --- a/tools/quick_dump/chipset_macro_wrap.c
> > +++ b/tools/quick_dump/chipset_macro_wrap.c
> > @@ -1,3 +1,5 @@
> > +#include 
> > +#include 
> >  #include 
> >  #include "intel_chipset.h"
> >  
> > @@ -31,3 +33,15 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
> >  {
> > return pdev->device_id;
> >  }
> > +
> > +bool igt_check_boolean_env_var(const char *env_var, bool default_value)
> > +{
> > +   char *val;
> > +
> > +   val = getenv(env_var);
> > +   if (!val)
> > +   return default_value;
> > +
> > +   return atoi(val) != 0;
> > +}
> > +
> > -- 
> > 1.9.1
> > 
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

-- 
Ben Widawsky, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] quick_dump: Fix the danvet fallout.

2014-03-25 Thread Daniel Vetter
On Tue, Mar 25, 2014 at 11:38:51AM -0700, Ben Widawsky wrote:
> quick_dump built fine, but it could actually run, since a lot of the
> linking happens at run time. There is one hack where we redefine the
> environment stuff, since depending on igt_aux means we have to pull in
> libdrm, which I do not want to do.

Why? libdrm is kinda something we need anyway ...
-Daniel

> 
> Cc: Ville Syrjälä 
> Signed-off-by: Ben Widawsky 
> ---
>  tools/quick_dump/Makefile.am  |  2 ++
>  tools/quick_dump/chipset.i|  5 +++--
>  tools/quick_dump/chipset_macro_wrap.c | 14 ++
>  3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
> index 7572ee5..ca26993 100644
> --- a/tools/quick_dump/Makefile.am
> +++ b/tools/quick_dump/Makefile.am
> @@ -8,6 +8,8 @@ bin_SCRIPTS = chipset.py
>  lib_LTLIBRARIES = I915ChipsetPython.la
>  I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 
> $(PCIACCESS_LIBS)
>  I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
> +$(top_srcdir)/lib/igt_core.c  \
> +$(top_srcdir)/lib/igt_debugfs.c  \
>  $(top_srcdir)/lib/intel_os.c  \
>  $(top_srcdir)/lib/intel_chipset.c  \
>  $(top_srcdir)/lib/intel_reg_map.c  \
> diff --git a/tools/quick_dump/chipset.i b/tools/quick_dump/chipset.i
> index 395418e..ae176e8 100644
> --- a/tools/quick_dump/chipset.i
> +++ b/tools/quick_dump/chipset.i
> @@ -4,6 +4,7 @@
>  #include 
>  #include 
>  #include "intel_chipset.h"
> +#include "intel_io.h"
>  extern int is_sandybridge(unsigned short pciid);
>  extern int is_ivybridge(unsigned short pciid);
>  extern int is_valleyview(unsigned short pciid);
> @@ -12,7 +13,7 @@ extern int is_broadwell(unsigned short pciid);
>  extern struct pci_device *intel_get_pci_device();
>  extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
>  extern uint32_t intel_register_read(uint32_t reg);
> -extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
> +extern void intel_register_write(uint32_t reg, uint32_t val);
>  extern void intel_register_access_fini();
>  extern int intel_register_access_needs_fakewake();
>  extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
> @@ -27,7 +28,7 @@ extern int is_broadwell(unsigned short pciid);
>  extern struct pci_device *intel_get_pci_device();
>  extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
>  extern uint32_t intel_register_read(uint32_t reg);
> -extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
> +extern void intel_register_write(uint32_t reg, uint32_t val);
>  extern void intel_register_access_fini();
>  extern int intel_register_access_needs_fakewake();
>  extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
> diff --git a/tools/quick_dump/chipset_macro_wrap.c 
> b/tools/quick_dump/chipset_macro_wrap.c
> index 392b85e..ee79777 100644
> --- a/tools/quick_dump/chipset_macro_wrap.c
> +++ b/tools/quick_dump/chipset_macro_wrap.c
> @@ -1,3 +1,5 @@
> +#include 
> +#include 
>  #include 
>  #include "intel_chipset.h"
>  
> @@ -31,3 +33,15 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
>  {
>   return pdev->device_id;
>  }
> +
> +bool igt_check_boolean_env_var(const char *env_var, bool default_value)
> +{
> + char *val;
> +
> + val = getenv(env_var);
> + if (!val)
> + return default_value;
> +
> + return atoi(val) != 0;
> +}
> +
> -- 
> 1.9.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] quick_dump: Fix the danvet fallout.

2014-03-25 Thread Ben Widawsky
quick_dump built fine, but it could actually run, since a lot of the
linking happens at run time. There is one hack where we redefine the
environment stuff, since depending on igt_aux means we have to pull in
libdrm, which I do not want to do.

Cc: Ville Syrjälä 
Signed-off-by: Ben Widawsky 
---
 tools/quick_dump/Makefile.am  |  2 ++
 tools/quick_dump/chipset.i|  5 +++--
 tools/quick_dump/chipset_macro_wrap.c | 14 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
index 7572ee5..ca26993 100644
--- a/tools/quick_dump/Makefile.am
+++ b/tools/quick_dump/Makefile.am
@@ -8,6 +8,8 @@ bin_SCRIPTS = chipset.py
 lib_LTLIBRARIES = I915ChipsetPython.la
 I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 
$(PCIACCESS_LIBS)
 I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
+  $(top_srcdir)/lib/igt_core.c  \
+  $(top_srcdir)/lib/igt_debugfs.c  \
   $(top_srcdir)/lib/intel_os.c  \
   $(top_srcdir)/lib/intel_chipset.c  \
   $(top_srcdir)/lib/intel_reg_map.c  \
diff --git a/tools/quick_dump/chipset.i b/tools/quick_dump/chipset.i
index 395418e..ae176e8 100644
--- a/tools/quick_dump/chipset.i
+++ b/tools/quick_dump/chipset.i
@@ -4,6 +4,7 @@
 #include 
 #include 
 #include "intel_chipset.h"
+#include "intel_io.h"
 extern int is_sandybridge(unsigned short pciid);
 extern int is_ivybridge(unsigned short pciid);
 extern int is_valleyview(unsigned short pciid);
@@ -12,7 +13,7 @@ extern int is_broadwell(unsigned short pciid);
 extern struct pci_device *intel_get_pci_device();
 extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
 extern uint32_t intel_register_read(uint32_t reg);
-extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
+extern void intel_register_write(uint32_t reg, uint32_t val);
 extern void intel_register_access_fini();
 extern int intel_register_access_needs_fakewake();
 extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
@@ -27,7 +28,7 @@ extern int is_broadwell(unsigned short pciid);
 extern struct pci_device *intel_get_pci_device();
 extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
 extern uint32_t intel_register_read(uint32_t reg);
-extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
+extern void intel_register_write(uint32_t reg, uint32_t val);
 extern void intel_register_access_fini();
 extern int intel_register_access_needs_fakewake();
 extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
diff --git a/tools/quick_dump/chipset_macro_wrap.c 
b/tools/quick_dump/chipset_macro_wrap.c
index 392b85e..ee79777 100644
--- a/tools/quick_dump/chipset_macro_wrap.c
+++ b/tools/quick_dump/chipset_macro_wrap.c
@@ -1,3 +1,5 @@
+#include 
+#include 
 #include 
 #include "intel_chipset.h"
 
@@ -31,3 +33,15 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
 {
return pdev->device_id;
 }
+
+bool igt_check_boolean_env_var(const char *env_var, bool default_value)
+{
+   char *val;
+
+   val = getenv(env_var);
+   if (!val)
+   return default_value;
+
+   return atoi(val) != 0;
+}
+
-- 
1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx