[Intel-gfx] [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()
Chang, Yu bruce
yu.bruce.chang at intel.com
Mon Dec 14 21:52:10 UTC 2020
>
>From: Chris Wilson <chris at chris-wilson.co.uk>
>Sent: Monday, December 14, 2020 12:48 PM
>To: Chang, Yu bruce; intel-gfx at lists.freedesktop.org
>Cc: igt-dev@
>Subject: Re: [Intel-gfx] [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()
>
>Quoting Chang, Yu bruce (2020-12-14 18:45:04)
>> +/**
>> + * gem_mappable_aperture_size:
>> + *
>> + * Feature test macro to query the kernel for the mappable gpu aperture size.
>> + * This is the area available for GTT memory mappings.
>> + *
> + * Returns: The mappable gtt address space size.
> + */
> +uint64_t gem_mappable_aperture_size(int fd)
> +{
> + struct pci_device *pci_dev = igt_device_get_pci_device(fd);
>
> Does it make sense to eliminate the function intel_get_pci_device() if not
> being used anymore? But it can be a separate patch.
>
>It's still used by tools. The complication there is that we mostly
>need to lookup the pci device without loading i915.ko.
>-Chris
>
That makes sense.
Then we need to make sure not start from a fix slot to look for GPU device in the intel_get_pci_device() below as
it may not work for a discrete GPU as that slot can be a non-vga device but with vendor_id 0x8086.
pci_dev = pci_device_find_by_slot(0, 0, 2, 0);
if (pci_dev == NULL || pci_dev->vendor_id != 0x8086) {
So, either add extra check to make sure it is VGA class or always use pci_device_next to search.
Thanks,
-Bruce
________________________________
From: Chris Wilson <chris at chris-wilson.co.uk>
Sent: Monday, December 14, 2020 12:48:40 PM
To: Chang, Yu bruce; intel-gfx at lists.freedesktop.org
Cc: igt-dev@
Subject: Re: [Intel-gfx] [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()
Quoting Chang, Yu bruce (2020-12-14 18:45:04)
> +/**
> + * gem_mappable_aperture_size:
> + *
> + * Feature test macro to query the kernel for the mappable gpu aperture size.
> + * This is the area available for GTT memory mappings.
> + *
> + * Returns: The mappable gtt address space size.
> + */
> +uint64_t gem_mappable_aperture_size(int fd)
> +{
> + struct pci_device *pci_dev = igt_device_get_pci_device(fd);
>
> Does it make sense to eliminate the function intel_get_pci_device() if not
> being used anymore? But it can be a separate patch.
It's still used by tools. The complication there is that we mostly
need to lookup the pci device without loading i915.ko.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20201214/c71d9c3e/attachment-0001.htm>
More information about the Intel-gfx
mailing list