From: Arunpravin Paneer Selvam <arunpravin.paneerselvam@amd.com>
To: Matthew Auld <matthew.auld@intel.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org
Cc: alexander.deucher@amd.com, luben.tuikov@amd.com,
christian.koenig@amd.com
Subject: Re: [Intel-gfx] [PATCH v2 4/6] drm/i915: Implement intersect/compatible functions
Date: Thu, 28 Jul 2022 20:06:21 +0530 [thread overview]
Message-ID: <2010b60f-7ef3-abe9-129b-af718d821ff7@amd.com> (raw)
In-Reply-To: <41eea55c-93d6-6406-d279-0583e17ab56c@intel.com>
Hi Matthew,
On 7/26/2022 4:11 PM, Matthew Auld wrote:
> On 25/07/2022 12:42, Arunpravin Paneer Selvam wrote:
>> Implemented a new intersect and compatible callback function
>> fetching start offset from drm buddy allocator.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Arunpravin Paneer Selvam
>> <Arunpravin.PaneerSelvam@amd.com>
>> ---
>> drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 43 +++++++++++++++++++
>> 1 file changed, 43 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
>> b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
>> index a5109548abc0..b5801c05bd41 100644
>> --- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
>> +++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
>> @@ -178,6 +178,47 @@ static void i915_ttm_buddy_man_free(struct
>> ttm_resource_manager *man,
>> kfree(bman_res);
>> }
>> +static bool i915_ttm_buddy_man_intersect(struct
>> ttm_resource_manager *man,
>> + struct ttm_resource *res,
>> + const struct ttm_place *place,
>> + size_t size)
>> +{
>> + struct i915_ttm_buddy_resource *bman_res =
>> to_ttm_buddy_resource(res);
>> + u32 start, num_pages = PFN_UP(size);
>> + struct drm_buddy_block *block;
>> +
>> + /* Check each drm buddy block individually */
>> + list_for_each_entry(block, &bman_res->blocks, link) {
>> + start = drm_buddy_block_offset(block) >> PAGE_SHIFT;
>> + /* Don't evict BOs outside of the requested placement range */
>> + if (place->fpfn >= (start + num_pages) ||
>> + (place->lpfn && place->lpfn <= start))
>> + return false;
>> + }
>> +
>> + return true;
>> +}
>
> This looks like a nice idea. We should be able to clean up
> i915_ttm_eviction_valuable() a fair bit I think, if we now call
> ttm_bo_eviction_valuable() at the end (like in amdgpu), and move the
> bits that are specific to buddy_man here?
>
> So something like:
>
> if (!place->fpfn && !place->lpfn)
> return true;
>
> if (!place->fpfn &&
> place->lpfn == i915_buddy_man_visible_size(man))
> return bman_res->used_visible_size > 0;
>
> /* Check each drm buddy block individually */
> ....
> modified in v3
>> +
>> +static bool i915_ttm_buddy_man_compatible(struct
>> ttm_resource_manager *man,
>> + struct ttm_resource *res,
>> + const struct ttm_place *place,
>> + size_t size)
>
> Is it not possible to derive the size from res->num_pages?
I think it is possible, I will check with Christian for any specific
case that might
require ttm_buffer_object->base.size
>
>> +{
>> + struct i915_ttm_buddy_resource *bman_res =
>> to_ttm_buddy_resource(res);
>> + u32 start, num_pages = PFN_UP(size);
>> + struct drm_buddy_block *block;
>> +
>> + /* Check each drm buddy block individually */
>> + list_for_each_entry(block, &bman_res->blocks, link) {
>> + start = drm_buddy_block_offset(block) >> PAGE_SHIFT;
>> + if (start < place->fpfn ||
>> + (place->lpfn && (start + num_pages) > place->lpfn))
>> + return false;
>> + }
>
> if (!place->fpfn && !place->lpfn)
> return true;
>
> if (!place->fpfn &&
> place->lpfn == i915_buddy_man_visible_size(man))
> return bman_res->used_visible_size == res->num_pages;
>
> /* Check each drm buddy block individually */
> ...
> modified in v3
>> +
>> + return true;
>> +}
>> +
>> static void i915_ttm_buddy_man_debug(struct ttm_resource_manager *man,
>> struct drm_printer *printer)
>> {
>> @@ -205,6 +246,8 @@ static void i915_ttm_buddy_man_debug(struct
>> ttm_resource_manager *man,
>> static const struct ttm_resource_manager_func
>> i915_ttm_buddy_manager_func = {
>> .alloc = i915_ttm_buddy_man_alloc,
>> .free = i915_ttm_buddy_man_free,
>> + .intersect = i915_ttm_buddy_man_intersect,
>
> s/intersect/intersects/ ?
> okay.
>> + .compatible = i915_ttm_buddy_man_compatible,
>> .debug = i915_ttm_buddy_man_debug,
>> };
next prev parent reply other threads:[~2022-07-28 14:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 11:42 [Intel-gfx] [PATCH v2 1/6] drm/ttm: Add new callbacks to ttm res mgr Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Intel-gfx] [PATCH v2 2/6] drm/ttm: Implement intersect/compatible functions Arunpravin Paneer Selvam
2022-08-08 11:30 ` Christian König
2022-08-09 8:26 ` Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Intel-gfx] [PATCH v2 3/6] drm/amdgpu: " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Intel-gfx] [PATCH v2 4/6] drm/i915: " Arunpravin Paneer Selvam
2022-07-26 10:41 ` Matthew Auld
2022-07-28 14:36 ` Arunpravin Paneer Selvam [this message]
2022-07-25 11:42 ` [Intel-gfx] [PATCH v2 5/6] drm/nouveau: " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Intel-gfx] [PATCH v2 6/6] drm/ttm: Switch to using the new res callback Arunpravin Paneer Selvam
2022-07-25 13:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/6] drm/ttm: Add new callbacks to ttm res mgr Patchwork
2022-07-25 14:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-08-08 11:28 ` [Intel-gfx] [PATCH v2 1/6] " Christian König
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=2010b60f-7ef3-abe9-129b-af718d821ff7@amd.com \
--to=arunpravin.paneerselvam@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=luben.tuikov@amd.com \
--cc=matthew.auld@intel.com \
--cc=nouveau@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