Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] i915: Handle the case where legacy mmap is not available
Date: Thu, 24 Jun 2021 11:02:04 +0200	[thread overview]
Message-ID: <ae91867b-546c-ce56-5b32-e293236e6f9b@linux.intel.com> (raw)
In-Reply-To: <87r1gsjbh3.wl-ashutosh.dixit@intel.com>

Op 24-06-2021 om 03:30 schreef Dixit, Ashutosh:
> On Tue, 11 May 2021 02:00:00 -0700, Maarten Lankhorst wrote:
>> @@ -84,10 +93,14 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
>>  {
>> 	struct drm_i915_gem_mmap_gtt mmap_arg;
>> 	void *ptr;
>> +	int ret;
>>
>> 	memset(&mmap_arg, 0, sizeof(mmap_arg));
>> 	mmap_arg.handle = handle;
>> -	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
>> +	ret = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
>> +	if (ret == -1 && errno == EOPNOTSUPP)
> What is the handler for DRM_IOCTL_I915_GEM_MMAP_GTT ioctl in i915 (in the
> kernel)? I am unable to find it so for now I am just assuming that it will
> just get routed to the handler for DRM_IOCTL_I915_GEM_MMAP and return
> EOPNOTSUPP for Gen12+ which is what the code above seems to be assuming.

tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP               DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP_GTT   DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP_OFFSET        DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)

I wasn't aware of that, even..

MMAP_GTT is MMAP_OFFSET with flags and extensions set to 0. Which means flags = I915_MMAP_OFFSET_GTT.

>> diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
>> index 7c36571c9bad..fdddd306acb5 100644
>> --- a/tests/i915/gem_mmap.c
>> +++ b/tests/i915/gem_mmap.c
>> @@ -154,8 +154,10 @@ igt_main
>> 	uint8_t buf[OBJECT_SIZE];
>> 	uint8_t *addr;
>>
>> -	igt_fixture
>> +	igt_fixture {
>> 		fd = drm_open_driver(DRIVER_INTEL);
>> +		igt_require(gem_has_legacy_mmap(fd));
>> +	}
>>
>> 	igt_subtest("bad-object") {
>> 		uint32_t real_handle = gem_create(fd, 4096);
>> diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c
>> index 4a2192b30689..ad2d510fcf09 100644
>> --- a/tests/i915/gem_mmap_wc.c
>> +++ b/tests/i915/gem_mmap_wc.c
>> @@ -504,6 +504,7 @@ igt_main
>>
>> 	igt_fixture {
>> 		fd = drm_open_driver(DRIVER_INTEL);
>> +		igt_require(gem_has_legacy_mmap(fd));
> I believe we also need to add this igt_require in other places where
> DRM_IOCTL_I915_GEM_MMAP and DRM_IOCTL_I915_GEM_MMAP_GTT ioctls are being
> calld directly without calling the functions in gem_mman.*. Looks like we
> should at least add this igt_require to:
>
> * tests/i915/gem_tiled_wc.c, and
> * test/i915/gem_mmap_gtt.c
>
> The remaining references are in overlay/ and tools/ so maybe we can figure
> out what to do for these later?
>
> With the above igt_require added to the two files above, this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

Yeah looks like you're right. I assumed that on gen12+ it would work, because mmap_gtt was not working. I didn't see it was actually still implemented, because DG1 lacks GTT. :-)

I'll add the extra check.

~Maarten

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-06-24  9:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  9:00 [igt-dev] [PATCH i-g-t] i915: Handle the case where legacy mmap is not available Maarten Lankhorst
2021-05-11  9:40 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-05-11  9:50 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2021-05-11 10:07   ` Maarten Lankhorst
2021-05-11 10:41     ` Petri Latvala
2021-05-11 10:48 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2021-05-11 16:19 ` [igt-dev] [PATCH i-g-t] " Dixit, Ashutosh
2021-05-26  9:36   ` Maarten Lankhorst
2021-05-18 15:08 ` [igt-dev] ✓ Fi.CI.BAT: success for i915: Handle the case where legacy mmap is not available (rev2) Patchwork
2021-05-19  3:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-18 13:45 ` [igt-dev] ✓ Fi.CI.BAT: success for i915: Handle the case where legacy mmap is not available (rev3) Patchwork
2021-06-18 15:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-24  1:30 ` [igt-dev] [PATCH i-g-t] i915: Handle the case where legacy mmap is not available Dixit, Ashutosh
2021-06-24  9:02   ` Maarten Lankhorst [this message]
2021-06-24 18:33     ` Dixit, Ashutosh

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=ae91867b-546c-ce56-5b32-e293236e6f9b@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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