> >From: Chris Wilson <ch...@chris-wilson.co.uk> >Sent: Monday, December 14, 2020 12:48 PM >To: Chang, Yu bruce; intel-gfx@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 <ch...@chris-wilson.co.uk> Sent: Monday, December 14, 2020 12:48:40 PM To: Chang, Yu bruce; intel-gfx@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
_______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx