From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Arunpravin.PaneerSelvam@amd.com, amd-gfx@lists.freedesktop.org
Subject: [PATCH 6/8] drm/amdgpu: use new cursor in amdgpu_mem_visible
Date: Mon, 8 Mar 2021 14:40:42 +0100 [thread overview]
Message-ID: <20210308134044.133658-6-christian.koenig@amd.com> (raw)
In-Reply-To: <20210308134044.133658-1-christian.koenig@amd.com>
Separate the drm_mm_node walking from the actual handling.
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Oak Zeng <Oak.Zeng@amd.com>
Tested-by: Nirmoy Das <nirmoy.das@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 2cbe4ace591f..d469ba5fef2c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -441,7 +441,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
static bool amdgpu_mem_visible(struct amdgpu_device *adev,
struct ttm_resource *mem)
{
- struct drm_mm_node *nodes = mem->mm_node;
+ uint64_t mem_size = (u64)mem->num_pages << PAGE_SHIFT;
+ struct amdgpu_res_cursor cursor;
if (mem->mem_type == TTM_PL_SYSTEM ||
mem->mem_type == TTM_PL_TT)
@@ -449,12 +450,13 @@ static bool amdgpu_mem_visible(struct amdgpu_device *adev,
if (mem->mem_type != TTM_PL_VRAM)
return false;
+ amdgpu_res_first(mem, 0, mem_size, &cursor);
+
/* ttm_resource_ioremap only supports contiguous memory */
- if (nodes->size != mem->num_pages)
+ if (cursor.size != mem_size)
return false;
- return ((nodes->start + nodes->size) << PAGE_SHIFT)
- <= adev->gmc.visible_vram_size;
+ return cursor.start + cursor.size <= adev->gmc.visible_vram_size;
}
/*
--
2.25.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2021-03-08 13:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 13:40 [PATCH 1/8] drm/amdgpu: new resource cursor Christian König
2021-03-08 13:40 ` [PATCH 2/8] drm/amdgpu: use the new cursor in amdgpu_ttm_copy_mem_to_mem Christian König
2021-03-08 13:40 ` [PATCH 3/8] drm/amdgpu: use the new cursor in amdgpu_fill_buffer Christian König
2021-03-08 13:40 ` [PATCH 4/8] drm/amdgpu: use new cursor in amdgpu_ttm_io_mem_pfn Christian König
2021-03-08 13:40 ` [PATCH 5/8] drm/amdgpu: use the new cursor in amdgpu_ttm_access_memory Christian König
2021-03-19 21:23 ` Felix Kuehling
2021-03-20 9:08 ` Christian König
2021-03-22 0:47 ` Pan, Xinhui
2021-03-22 1:19 ` Pan, Xinhui
2021-03-08 13:40 ` Christian König [this message]
2021-03-08 13:40 ` [PATCH 7/8] drm/amdgpu: use the new cursor in amdgpu_ttm_bo_eviction_valuable Christian König
2021-03-08 13:40 ` [PATCH 8/8] drm/amdgpu: use the new cursor in the VM code Christian König
2021-03-12 10:52 ` [PATCH 1/8] drm/amdgpu: new resource cursor Christian König
2021-03-12 11:11 ` Paneer Selvam, Arunpravin
2021-03-12 12:16 ` Christian König
-- strict thread matches above, loose matches on Subject: below --
2021-02-17 19:00 Christian König
2021-02-17 19:00 ` [PATCH 6/8] drm/amdgpu: use new cursor in amdgpu_mem_visible 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=20210308134044.133658-6-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=amd-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.