[igt-dev] [PATCH i-g-t] tests/kms: Return false in gem_has_lmem for platforms not having LMEM support
Srinivas, Vidya
vidya.srinivas at intel.com
Sat Jul 24 17:43:45 UTC 2021
> -----Original Message-----
> From: Dixit, Ashutosh <ashutosh.dixit at intel.com>
> Sent: Friday, July 23, 2021 10:47 PM
> To: Srinivas, Vidya <vidya.srinivas at intel.com>
> Cc: igt-dev at lists.freedesktop.org; Joshi, Kunal1 <kunal1.joshi at intel.com>;
> Latvala, Petri <petri.latvala at intel.com>; Heikkila, Juha-pekka <juha-
> pekka.heikkila at intel.com>; Lin, Charlton <charlton.lin at intel.com>
> Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms: Return false in gem_has_lmem
> for platforms not having LMEM support
>
> On Fri, 23 Jul 2021 02:35:48 -0700, Vidya Srinivas wrote:
> >
> > Starting commit (tests/kms: Create buffer object from LMEM for
> > discrete) it checks for LMEM. But this is breaking older kernels like
> > 5.4 without DRM_I915_QUERY_MEMORY_REGIONS support. This causes
> > item.length filled from IOCTL to be < 0 and gives segmentation fault.
> > Another way to fix is check for NULL query in
> > gem_get_lmem_region_count and return false.
> >
> > Patch returns false from gem_has_lmem for obvious platforms which dont
> > have LMEM support and also adds the check for NULL query in
> > gem_get_lmem_region_count.
> >
> > Signed-off-by: Lin Charlton <charlton.lin at intel.com>
> > Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
> > ---
> > lib/i915/intel_memory_region.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/lib/i915/intel_memory_region.c
> > b/lib/i915/intel_memory_region.c index 144ae12ca7a0..635c21ab3765
> > 100644
> > --- a/lib/i915/intel_memory_region.c
> > +++ b/lib/i915/intel_memory_region.c
> > @@ -143,6 +143,10 @@ uint8_t gem_get_lmem_region_count(int fd)
> > uint8_t lmem_regions = 0;
> >
> > query_info = gem_get_query_memory_regions(fd);
> > +
> > + if (!query_info)
> > + return 0;
>
> From the code doesn't look like this works.
>
> > +
> > num_regions = query_info->num_regions;
> >
> > for (int i = 0; i < num_regions; i++) { @@ -164,6 +168,9 @@ uint8_t
> >gem_get_lmem_region_count(int fd)
> > */
> > bool gem_has_lmem(int fd)
> > {
> > + if (intel_display_ver(intel_get_drm_devid(fd) < 12) ||
> > + IS_ALDERLAKE_P(intel_get_drm_devid(fd)) ||
> IS_TIGERLAKE(intel_get_drm_devid(fd)))
> > + return false;
>
> No platform checks. Check if DRM_I915_QUERY_MEMORY_REGIONS is not
> supported and in that case return 0 from gem_get_lmem_region_count.
Thank you Ashutosh. Maybe we should just make our kernel return
Error. Right now that is missing. Then we wont need this patch.
I had submitted v3. But we can ignore that maybe. Sorry.
>
> > return gem_get_lmem_region_count(fd) > 0;
> > }
More information about the igt-dev
mailing list