Re: [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>
>From: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
>Sent: Monday, December 14, 2020 12:48 PM
>To: Chang, Yu bruce; intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>Cc: igt-dev@
>Subject: Re: [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@xxxxxxxxxxxxxxxxxx>
Sent: Monday, December 14, 2020 12:48:40 PM
To: Chang, Yu bruce; intel-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: igt-dev@
Subject: Re: [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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux