From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: christian.koenig@amd.com, bskeggs@redhat.com
Subject: [PATCH 2/7] drm/ttm: wrap tt destroy.
Date: Tue, 15 Sep 2020 12:40:02 +1000 [thread overview]
Message-ID: <20200915024007.67163-3-airlied@gmail.com> (raw)
In-Reply-To: <20200915024007.67163-1-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
All places this was called was using bo->ttm either direct
or indirectly.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 9 +++------
drivers/gpu/drm/ttm/ttm_bo_util.c | 24 ++++++++++++------------
include/drm/ttm/ttm_bo_driver.h | 5 +++++
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index e2bfe3a13c63..9aae9e1bd8e8 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -301,10 +301,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
out_err:
new_man = ttm_manager_type(bdev, bo->mem.mem_type);
- if (!new_man->use_tt) {
- ttm_tt_destroy(bdev, bo->ttm);
- bo->ttm = NULL;
- }
+ if (!new_man->use_tt)
+ ttm_bo_tt_destroy(bo);
return ret;
}
@@ -322,8 +320,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
if (bo->bdev->driver->move_notify)
bo->bdev->driver->move_notify(bo, false, NULL);
- ttm_tt_destroy(bo->bdev, bo->ttm);
- bo->ttm = NULL;
+ ttm_bo_tt_destroy(bo);
ttm_resource_free(bo, &bo->mem);
}
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 44b47ccdeaf7..0ddaaa1ddafd 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -297,10 +297,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
*old_mem = *new_mem;
new_mem->mm_node = NULL;
- if (!man->use_tt) {
- ttm_tt_destroy(bdev, ttm);
- bo->ttm = NULL;
- }
+ if (!man->use_tt)
+ ttm_bo_tt_destroy(bo);
out1:
ttm_resource_iounmap(bdev, old_mem, new_iomap);
@@ -542,10 +540,8 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret)
return ret;
- if (!man->use_tt) {
- ttm_tt_destroy(bdev, bo->ttm);
- bo->ttm = NULL;
- }
+ if (!man->use_tt)
+ ttm_bo_tt_destroy(bo);
ttm_bo_free_old_node(bo);
} else {
/**
@@ -665,10 +661,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
if (ret)
return ret;
- if (!to->use_tt) {
- ttm_tt_destroy(bdev, bo->ttm);
- bo->ttm = NULL;
- }
+ if (!to->use_tt)
+ ttm_bo_tt_destroy(bo);
ttm_bo_free_old_node(bo);
}
@@ -702,3 +696,9 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
return 0;
}
+
+void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
+{
+ ttm_tt_destroy(bo->bdev, bo->ttm);
+ bo->ttm = NULL;
+}
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 303a89d1066d..c2e93f04d0ad 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -684,6 +684,11 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);
*/
pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
+/**
+ * ttm_bo_tt_destroy.
+ */
+void ttm_bo_tt_destroy(struct ttm_buffer_object *bo);
+
/**
* ttm_range_man_init
*
--
2.27.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-09-15 2:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 2:40 Dave Airlie
2020-09-15 2:40 ` [PATCH 1/7] drm/ttm/tt: add wrappers to set tt state Dave Airlie
2020-09-15 2:40 ` Dave Airlie [this message]
2020-09-15 7:47 ` [PATCH 2/7] drm/ttm: wrap tt destroy Christian König
2020-09-15 2:40 ` [PATCH 3/7] drm/ttm: tt destroy move null check to outer function Dave Airlie
2020-09-15 2:40 ` [PATCH 4/7] drm/ttm: split populate out from binding Dave Airlie
2020-09-15 7:50 ` Christian König
2020-09-15 2:40 ` [PATCH 5/7] drm/ttm: move ttm binding/unbinding out of ttm_tt paths Dave Airlie
2020-09-15 2:40 ` [PATCH 6/7] drm/ttm: split bound/populated flags Dave Airlie
2020-09-15 2:40 ` [PATCH 7/7] drm/ttm: move populated state into page flags Dave Airlie
2020-09-15 7:53 ` 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=20200915024007.67163-3-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=PATCH@freedesktop.org \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=drm@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;
as well as URLs for NNTP newsgroup(s).