From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 2/8] drm/ttm: use an operation ctx for ttm_bo_init_reserved
Date: Fri, 17 Nov 2017 11:49:29 +0100 [thread overview]
Message-ID: <20171117104935.4150-3-christian.koenig@amd.com> (raw)
In-Reply-To: <20171117104935.4150-1-christian.koenig@amd.com>
Instead of specifying if sleeping should be interruptible.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
drivers/gpu/drm/ttm/ttm_bo.c | 12 +++++-------
include/drm/ttm/ttm_bo_api.h | 5 ++---
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index c2419bc6b3df..15027f751e07 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -327,6 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
uint64_t init_value,
struct amdgpu_bo **bo_ptr)
{
+ struct ttm_operation_ctx ctx = { !kernel, false };
struct amdgpu_bo *bo;
enum ttm_bo_type type;
unsigned long page_align;
@@ -408,7 +409,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
/* Kernel allocation are uninterruptible */
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
- &bo->placement, page_align, !kernel, NULL,
+ &bo->placement, page_align, &ctx, NULL,
acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
if (unlikely(r != 0))
return r;
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 5347c3f3e2f4..1f6957adc19e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1132,7 +1132,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
enum ttm_bo_type type,
struct ttm_placement *placement,
uint32_t page_alignment,
- bool interruptible,
+ struct ttm_operation_ctx *ctx,
struct file *persistent_swap_storage,
size_t acc_size,
struct sg_table *sg,
@@ -1218,11 +1218,8 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
WARN_ON(!locked);
}
- if (likely(!ret)) {
- struct ttm_operation_ctx ctx = { interruptible, false };
-
- ret = ttm_bo_validate(bo, placement, &ctx);
- }
+ if (likely(!ret))
+ ret = ttm_bo_validate(bo, placement, ctx);
if (unlikely(ret)) {
if (!resv)
@@ -1255,10 +1252,11 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
struct reservation_object *resv,
void (*destroy) (struct ttm_buffer_object *))
{
+ struct ttm_operation_ctx ctx = { interruptible, false };
int ret;
ret = ttm_bo_init_reserved(bdev, bo, size, type, placement,
- page_alignment, interruptible,
+ page_alignment, &ctx,
persistent_swap_storage, acc_size,
sg, resv, destroy);
if (ret)
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 097951e999bc..d0164d131982 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -455,8 +455,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
* @type: Requested type of buffer object.
* @flags: Initial placement flags.
* @page_alignment: Data alignment in pages.
- * @interruptible: If needing to sleep to wait for GPU resources,
- * sleep interruptible.
+ * @ctx: TTM operation context for memory allocation.
* @persistent_swap_storage: Usually the swap storage is deleted for buffers
* pinned in physical memory. If this behaviour is not desired, this member
* holds a pointer to a persistent shmem object. Typically, this would
@@ -493,7 +492,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
enum ttm_bo_type type,
struct ttm_placement *placement,
uint32_t page_alignment,
- bool interrubtible,
+ struct ttm_operation_ctx *ctx,
struct file *persistent_swap_storage,
size_t acc_size,
struct sg_table *sg,
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-11-17 10:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 10:49 Operation context for TTM Christian König
2017-11-17 10:49 ` [PATCH 1/8] drm/ttm: add operation ctx to ttm_bo_validate v2 Christian König
[not found] ` <20171117104935.4150-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2017-11-20 10:14 ` Daniel Vetter
2017-11-17 10:49 ` Christian König [this message]
2017-11-17 10:49 ` [PATCH 4/8] drm/ttm: use the operation context inside TTM Christian König
2017-11-17 10:49 ` [PATCH 7/8] drm/amdgpu: forward operation context to ttm_bo_mem_space Christian König
[not found] ` <20171117104935.4150-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2017-11-17 10:49 ` [PATCH 3/8] drm/ttm: use an operation context for ttm_bo_mem_space v2 Christian König
2017-11-17 10:49 ` [PATCH 5/8] drm/ttm: add context to driver move callback as well Christian König
2017-11-17 10:49 ` [PATCH 6/8] drm/ttm: add number of bytes moved to the operation context Christian König
2017-11-17 10:49 ` [PATCH 8/8] drm/amdgpu: use the new TTM bytes moved counter v2 Christian König
[not found] ` <20171117104935.4150-9-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2017-11-20 2:38 ` Chunming Zhou
2017-11-17 14:55 ` Operation context for TTM Michel Dänzer
2017-11-17 20:26 ` Felix Kuehling
2017-11-20 4:35 ` Dieter Nützel
[not found] ` <cb11aafa8199f35d8ab93f7199c1f1c0-0hun7QTegEsDD4udEopG9Q@public.gmane.org>
2017-11-21 2:49 ` Dieter Nützel
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=20171117104935.4150-3-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@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