From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@intel.com>
Cc: IGT dev <igt-dev@lists.freedesktop.org>,
Andi Shyti <andi@etezian.org>,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH v3 2/3] lib: implement new engine discovery interface
Date: Wed, 28 Nov 2018 08:29:25 +0000 [thread overview]
Message-ID: <49a265f3-c714-f4ec-7d49-d0eff5be4714@linux.intel.com> (raw)
In-Reply-To: <20181127203325.GA21386@intel.intel>
On 27/11/2018 20:33, Andi Shyti wrote:
> Hi Tvrtko,
>
>>> + ctx_param.ctx_id = ctx_id;
>>> + ctx_param.size = size;
>>> + ctx_param.param = I915_CONTEXT_PARAM_ENGINES;
>>> + ctx_param.value = to_user_pointer(ctx_engine);
>>> +
>>> + /* check whether we free the engines */
>>> + igt_require(!ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &ctx_param));
>>> +
>>> + free(ctx_engine);
>>
>> Leaks on skip, not that it matters a lot, but the comments makes me think
>> you wanted to handle it.
>
> The comment is a leftover from the cleanup. I need to fix/remove
> it.
>
> While as for freeing ctx_engine in case of failure, some ugly code
> would be required. I think it's cleaner to leave it as it is,
> anyway 'igt_require' exits in case of failure.
Yeah, ok.
>>> +#define for_each_engine_ctx(fd, ctx, e) \
>>> + for (int __m = __gem_setup_ctx_engines(fd, ctx), __e = e = 1; \
>>> + __e <= __m; e = ++__e)
>>> +
>>
>> Is __e needed? Could just use passed in e?
>
> I cannot mix declarations and "already declared variables"
> initializations in the first expression in 'for'. If I do
> something like:
>
> for (int __m = __gem_setup_ctx_engines(), e = 1; ... )
>
> I would re-define 'e' and it would be a different variable
> outside the loop.
>
> So that either I declare '__m' outside, or I initialize 'e'
> outside, or I use the double 'for' loop as it was done
> previously, or do some ugly tricks.
>
> It looked simplier to define an '__e'.
>
> Am I missing anything?
No, looks like you're right, makes sense.
>>> bool gem_ring_is_physical_engine(int fd, unsigned int ring);
>>> bool gem_ring_has_physical_engine(int fd, unsigned int ring);
>>> +int __gem_setup_ctx_engines(int fd, uint32_t ctx_id);
>>> bool gem_can_store_dword(int fd, unsigned int engine);
>>>
>>
>> Looks okay. But we need to decide whether we want the iterator to be a
>> struct sooner rather than later now.
>>
>> I think if you go and convert one of the tests which uses
>> for_each_physical_engine to enumerate subtests and so, it will become
>> clearer what approach work better. (struct iterator, or helpers to get data
>> from engine index.)
>
> All right, I'll try it out and I will post something as a reply to this
> patch.
Ack.
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-11-28 8:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 20:43 [igt-dev] [PATCH v3 0/3] new engine discovery interface Andi Shyti
2018-11-26 20:43 ` [igt-dev] [PATCH v3 1/3] include/drm-uapi: import i915_drm.h header file Andi Shyti
2018-11-26 20:43 ` [igt-dev] [PATCH v3 2/3] lib: implement new engine discovery interface Andi Shyti
2018-11-27 12:00 ` Tvrtko Ursulin
2018-11-27 20:33 ` Andi Shyti
2018-11-28 8:29 ` Tvrtko Ursulin [this message]
2018-12-14 15:34 ` [igt-dev] [PATCH v3.5 " Andi Shyti
2018-12-21 11:48 ` Tvrtko Ursulin
2018-11-26 20:43 ` [igt-dev] [PATCH v3 3/3] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test Andi Shyti
2018-11-26 21:10 ` Chris Wilson
2018-11-27 11:40 ` Tvrtko Ursulin
2018-11-26 22:23 ` [igt-dev] ✗ Fi.CI.BAT: failure for new engine discovery interface (rev3) Patchwork
2018-12-14 15:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for new engine discovery interface (rev4) 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=49a265f3-c714-f4ec-7d49-d0eff5be4714@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=andi.shyti@intel.com \
--cc=andi@etezian.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@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