From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: christian.koenig@amd.com, rscheidegger.oss@gmail.com
Subject: [PATCH 3/5] drm/vmwgfx: add a move callback.
Date: Tue, 6 Oct 2020 10:06:42 +1000 [thread overview]
Message-ID: <20201006000644.1005758-4-airlied@gmail.com> (raw)
In-Reply-To: <20201006000644.1005758-1-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
This just copies the fallback to vmwgfx, I'm going to iterate on this
a bit until it's not the same as the fallback path.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index 2f88d2d79f9a..6e36fc932aeb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -725,6 +725,23 @@ static void vmw_swap_notify(struct ttm_buffer_object *bo)
(void) ttm_bo_wait(bo, false, false);
}
+static int vmw_move(struct ttm_buffer_object *bo,
+ bool evict,
+ struct ttm_operation_ctx *ctx,
+ struct ttm_resource *new_mem)
+{
+ struct ttm_resource_manager *old_man = ttm_manager_type(bo->bdev, bo->mem.mem_type);
+ struct ttm_resource_manager *new_man = ttm_manager_type(bo->bdev, new_mem->mem_type);
+
+ if (old_man->use_tt && new_man->use_tt) {
+ if (bo->mem.mem_type == TTM_PL_SYSTEM) {
+ ttm_bo_assign_mem(bo, new_mem);
+ return 0;
+ }
+ return ttm_bo_move_ttm(bo, ctx, new_mem);
+ } else
+ return ttm_bo_move_memcpy(bo, ctx, new_mem);
+}
struct ttm_bo_driver vmw_bo_driver = {
.ttm_tt_create = &vmw_ttm_tt_create,
@@ -735,7 +752,7 @@ struct ttm_bo_driver vmw_bo_driver = {
.ttm_tt_destroy = &vmw_ttm_destroy,
.eviction_valuable = ttm_bo_eviction_valuable,
.evict_flags = vmw_evict_flags,
- .move = NULL,
+ .move = vmw_move,
.verify_access = vmw_verify_access,
.move_notify = vmw_move_notify,
.swap_notify = vmw_swap_notify,
--
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-10-06 0:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 0:06 [PATCH 0/5] ttm make move callback compulsory Dave Airlie
2020-10-06 0:06 ` [PATCH 1/5] drm/qxl: drop unused code (v2) Dave Airlie
2020-10-06 0:06 ` [PATCH 2/5] drm/vmwgfx: move null mem checks outside move notifies Dave Airlie
2020-10-08 3:39 ` Zack Rusin
2020-10-06 0:06 ` Dave Airlie [this message]
2020-10-08 3:41 ` [PATCH 3/5] drm/vmwgfx: add a move callback Zack Rusin
2020-10-08 4:02 ` Dave Airlie
2020-10-08 15:35 ` Roland Scheidegger
2020-10-06 0:06 ` [PATCH 4/5] drm/vram_helper: implement a ttm " Dave Airlie
2020-10-06 0:06 ` [PATCH 5/5] drm/ttm: make move callback compulstory Dave Airlie
2020-10-06 10:29 ` [PATCH 0/5] ttm make move callback compulsory 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=20201006000644.1005758-4-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=rscheidegger.oss@gmail.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;
as well as URLs for NNTP newsgroup(s).