[Intel-gfx] [intel-gpu-tools] [PATCH 1/3] intel-gpu-tools add ioctl interface usage

Kenneth Graunke kenneth at whitecape.org
Wed Apr 6 20:38:11 CEST 2011


On 04/05/2011 12:33 PM, Ben Widawsky wrote:
> Added the mechnanism to communicate with the i915 IOCTL interface, and
> removed the existing forcewake code, as it is not reliable.
>
> Modified gpu_top to take a flag -i, to use the IOCTL interface. Previous
> gpu_top behavior with no args is maintained from previous version.
>
> Signed-off-by: Ben Widawsky<ben at bwidawsk.net>
> ---
>   lib/intel_gpu_tools.h |   58 +++++++++++++++++++++++++++++++++++++++++++++++-
>   lib/intel_mmio.c      |   18 +++++++++++++++
>   tools/intel_gpu_top.c |   45 +++++++++++--------------------------
>   3 files changed, 88 insertions(+), 33 deletions(-)

One high level comment and a nitpick...

I'm a bit surprised that there's a command line option to use the IOCTL 
interface (i.e. non-broken mode).  Shouldn't it try the IOCTL and, if 
the kernel doesn't support it, fall back to using MMIO?

Or, perhaps better...try using the IOCTL by default on gen6, and if it 
fails, print a message like "Your kernel doesn't support the necessary 
IOCTLs; please upgrade or run intel_gpu_top -m to force MMIO mode (which 
may be inaccurate)." and quit.

> +#define INREG(reg) \
> +	(use_ioctl_mmio ? INREG_IOCTL(reg) : INREG_PCI(reg))
> +
> +#define OUTREG(reg, val) \
> +	(use_ioctl_mmio ? OUTREG_IOCTL(reg, val) : OUTREG_PCI(reg, val))
> +
>   static inline uint32_t
> -INREG(uint32_t reg)
> +INREG_PCI(uint32_t reg)
>   {
>   	return *(volatile uint32_t *)((volatile char *)mmio + reg);
>   }

As long as you're renaming these, can we please use lowercase for inline 
functions, while keeping the INREG/OUTREG macros uppercase?

> +/*
> + * Try to read a register using the i915 IOCTL interface. The operations should
> + * not fall back to the normal pci mmio method to avoid confusion. IOCTL usage
> + * should be explicitly specified.
> + */



More information about the Intel-gfx mailing list