Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Vidya Srinivas <vidya.srinivas@intel.com>
Cc: igt-dev@lists.freedesktop.org, kunal1.joshi@intel.com,
	Lin Charlton <charlton.lin@intel.com>,
	petri.latvala@intel.com, juha-pekka.heikkila@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms: Return false in gem_has_lmem for platforms not having LMEM support
Date: Fri, 23 Jul 2021 10:16:49 -0700	[thread overview]
Message-ID: <87v9519chq.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20210723093548.22273-1-vidya.srinivas@intel.com>

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@intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@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.

>	return gem_get_lmem_region_count(fd) > 0;
>  }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2021-07-23 17:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23  9:35 [igt-dev] [PATCH i-g-t] tests/kms: Return false in gem_has_lmem for platforms not having LMEM support Vidya Srinivas
2021-07-23 12:12 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-07-23 17:16 ` Dixit, Ashutosh [this message]
2021-07-24 16:07   ` [igt-dev] [PATCH i-g-t] " Srinivas, Vidya
2021-07-24 17:00   ` Srinivas, Vidya
2021-07-24 17:43   ` Srinivas, Vidya
2021-07-23 18:19 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2021-07-24 16:46 ` [igt-dev] [PATCH] tests/kms: Return false in gem_has_lmem for kernels not having DRM_I915_QUERY_MEMORY_REGIONS support Vidya Srinivas
2021-07-24 16:53   ` [igt-dev] [PATCH i-g-t] " Vidya Srinivas
2021-07-24 21:20     ` Dixit, Ashutosh
2021-07-26  6:18       ` Srinivas, Vidya
2021-07-26  6:06     ` [igt-dev] [PATCH i-g-t] lib/i915: " Vidya Srinivas
2021-07-26  6:52       ` Modem, Bhanuprakash
2021-07-24 17:32 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms: Return false in gem_has_lmem for platforms not having LMEM support (rev2) Patchwork
2021-07-24 18:03 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms: Return false in gem_has_lmem for platforms not having LMEM support (rev3) Patchwork
2021-07-24 18:40 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms: Return false in gem_has_lmem for platforms not having LMEM support (rev2) Patchwork
2021-07-24 19:34 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms: Return false in gem_has_lmem for platforms not having LMEM support (rev3) Patchwork
2021-07-26  6:52 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms: Return false in gem_has_lmem for platforms not having LMEM support (rev4) Patchwork
2021-07-26  8:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9519chq.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=charlton.lin@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juha-pekka.heikkila@intel.com \
    --cc=kunal1.joshi@intel.com \
    --cc=petri.latvala@intel.com \
    --cc=vidya.srinivas@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox