dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] ttm make move callback compulsory
@ 2020-10-06  0:06 Dave Airlie
  2020-10-06  0:06 ` [PATCH 1/5] drm/qxl: drop unused code (v2) Dave Airlie
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

I've just pulled out the few bits for making the move callback compulsory
from my previous series.

The vmwgfx ones need acks/r-bs, I've booted them in vmplayer and they
seem to work fine.

Dave.


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] drm/qxl: drop unused code (v2)
  2020-10-06  0:06 [PATCH 0/5] ttm make move callback compulsory Dave Airlie
@ 2020-10-06  0:06 ` Dave Airlie
  2020-10-06  0:06 ` [PATCH 2/5] drm/vmwgfx: move null mem checks outside move notifies Dave Airlie
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

From: Dave Airlie <airlied@redhat.com>

v2: drop the wrapper struct
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_ttm.c | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 2c35ca4270c6..669bceb58205 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -98,19 +98,11 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
 /*
  * TTM backend functions.
  */
-struct qxl_ttm_tt {
-	struct ttm_tt		        ttm;
-	struct qxl_device		*qdev;
-	u64				offset;
-};
 
 static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev,
 				struct ttm_tt *ttm,
 				struct ttm_resource *bo_mem)
 {
-	struct qxl_ttm_tt *gtt = (void *)ttm;
-
-	gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);
 	if (!ttm->num_pages) {
 		WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",
 		     ttm->num_pages, bo_mem, ttm);
@@ -128,29 +120,24 @@ static void qxl_ttm_backend_unbind(struct ttm_bo_device *bdev,
 static void qxl_ttm_backend_destroy(struct ttm_bo_device *bdev,
 				    struct ttm_tt *ttm)
 {
-	struct qxl_ttm_tt *gtt = (void *)ttm;
-
 	ttm_tt_destroy_common(bdev, ttm);
-	ttm_tt_fini(&gtt->ttm);
-	kfree(gtt);
+	ttm_tt_fini(ttm);
+	kfree(ttm);
 }
 
 static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,
 					uint32_t page_flags)
 {
-	struct qxl_device *qdev;
-	struct qxl_ttm_tt *gtt;
+	struct ttm_tt *ttm;
 
-	qdev = qxl_get_qdev(bo->bdev);
-	gtt = kzalloc(sizeof(struct qxl_ttm_tt), GFP_KERNEL);
-	if (gtt == NULL)
+	ttm = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL);
+	if (ttm == NULL)
 		return NULL;
-	gtt->qdev = qdev;
-	if (ttm_tt_init(&gtt->ttm, bo, page_flags)) {
-		kfree(gtt);
+	if (ttm_tt_init(ttm, bo, page_flags)) {
+		kfree(ttm);
 		return NULL;
 	}
-	return &gtt->ttm;
+	return ttm;
 }
 
 static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] drm/vmwgfx: move null mem checks outside move notifies
  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 ` Dave Airlie
  2020-10-08  3:39   ` Zack Rusin
  2020-10-06  0:06 ` [PATCH 3/5] drm/vmwgfx: add a move callback Dave Airlie
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

From: Dave Airlie <airlied@redhat.com>

Both fns checked mem == NULL, just move the check outside.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c         | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c   | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index 9a66ba254326..263d76ae43f0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -1192,9 +1192,6 @@ void vmw_bo_move_notify(struct ttm_buffer_object *bo,
 {
 	struct vmw_buffer_object *vbo;
 
-	if (mem == NULL)
-		return;
-
 	/* Make sure @bo is embedded in a struct vmw_buffer_object? */
 	if (bo->destroy != vmw_bo_bo_free &&
 	    bo->destroy != vmw_user_bo_destroy)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 5e922d9d5f2c..00b535831a7a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -867,7 +867,7 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,
 	mutex_lock(&dev_priv->binding_mutex);
 
 	dx_query_mob = container_of(bo, struct vmw_buffer_object, base);
-	if (mem == NULL || !dx_query_mob || !dx_query_mob->dx_query_ctx) {
+	if (!dx_query_mob || !dx_query_mob->dx_query_ctx) {
 		mutex_unlock(&dev_priv->binding_mutex);
 		return;
 	}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index fc68f54df46a..2f88d2d79f9a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -707,6 +707,8 @@ static void vmw_move_notify(struct ttm_buffer_object *bo,
 			    bool evict,
 			    struct ttm_resource *mem)
 {
+	if (!mem)
+		return;
 	vmw_bo_move_notify(bo, mem);
 	vmw_query_move_notify(bo, mem);
 }
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] drm/vmwgfx: add a move callback.
  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-06  0:06 ` Dave Airlie
  2020-10-08  3:41   ` Zack Rusin
  2020-10-08 15:35   ` Roland Scheidegger
  2020-10-06  0:06 ` [PATCH 4/5] drm/vram_helper: implement a ttm " Dave Airlie
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] drm/vram_helper: implement a ttm move callback.
  2020-10-06  0:06 [PATCH 0/5] ttm make move callback compulsory Dave Airlie
                   ` (2 preceding siblings ...)
  2020-10-06  0:06 ` [PATCH 3/5] drm/vmwgfx: add a move callback Dave Airlie
@ 2020-10-06  0:06 ` 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
  5 siblings, 0 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

From: Dave Airlie <airlied@redhat.com>

This will always do memcpy moves.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_gem_vram_helper.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index 3fe4b326e18e..3213429f8444 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -588,6 +588,14 @@ static void drm_gem_vram_bo_driver_move_notify(struct drm_gem_vram_object *gbo,
 	kmap->virtual = NULL;
 }
 
+static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,
+				       bool evict,
+				       struct ttm_operation_ctx *ctx,
+				       struct ttm_resource *new_mem)
+{
+	return ttm_bo_move_memcpy(&gbo->bo, ctx, new_mem);
+}
+
 /*
  * Helpers for struct drm_gem_object_funcs
  */
@@ -950,6 +958,18 @@ static void bo_driver_move_notify(struct ttm_buffer_object *bo,
 	drm_gem_vram_bo_driver_move_notify(gbo, evict, new_mem);
 }
 
+static int bo_driver_move(struct ttm_buffer_object *bo,
+			  bool evict,
+			  struct ttm_operation_ctx *ctx,
+			  struct ttm_resource *new_mem)
+{
+	struct drm_gem_vram_object *gbo;
+
+	gbo = drm_gem_vram_of_bo(bo);
+
+	return drm_gem_vram_bo_driver_move(gbo, evict, ctx, new_mem);
+}
+
 static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,
 				    struct ttm_resource *mem)
 {
@@ -974,6 +994,7 @@ static struct ttm_bo_driver bo_driver = {
 	.ttm_tt_destroy = bo_driver_ttm_tt_destroy,
 	.eviction_valuable = ttm_bo_eviction_valuable,
 	.evict_flags = bo_driver_evict_flags,
+	.move = bo_driver_move,
 	.move_notify = bo_driver_move_notify,
 	.io_mem_reserve = bo_driver_io_mem_reserve,
 };
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] drm/ttm: make move callback compulstory
  2020-10-06  0:06 [PATCH 0/5] ttm make move callback compulsory Dave Airlie
                   ` (3 preceding siblings ...)
  2020-10-06  0:06 ` [PATCH 4/5] drm/vram_helper: implement a ttm " Dave Airlie
@ 2020-10-06  0:06 ` Dave Airlie
  2020-10-06 10:29 ` [PATCH 0/5] ttm make move callback compulsory Christian König
  5 siblings, 0 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-06  0:06 UTC (permalink / raw)
  To: dri-devel; +Cc: christian.koenig, rscheidegger.oss

From: Dave Airlie <airlied@redhat.com>

All drivers should have a move callback now so make it compulsory.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index e11e8eaa6602..88d215de9ae1 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -270,18 +270,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 	if (bdev->driver->move_notify)
 		bdev->driver->move_notify(bo, evict, mem);
 
-	if (old_man->use_tt && new_man->use_tt) {
-		if (bo->mem.mem_type == TTM_PL_SYSTEM) {
-			ttm_bo_assign_mem(bo, mem);
-			ret = 0;
-		} else
-			ret = ttm_bo_move_ttm(bo, ctx, mem);
-	} else if (bdev->driver->move) {
-		ret = bdev->driver->move(bo, evict, ctx, mem);
-	} else {
-		ret = ttm_bo_move_memcpy(bo, ctx, mem);
-	}
-
+	ret = bdev->driver->move(bo, evict, ctx, mem);
 	if (ret) {
 		if (bdev->driver->move_notify) {
 			swap(*mem, bo->mem);
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] ttm make move callback compulsory
  2020-10-06  0:06 [PATCH 0/5] ttm make move callback compulsory Dave Airlie
                   ` (4 preceding siblings ...)
  2020-10-06  0:06 ` [PATCH 5/5] drm/ttm: make move callback compulstory Dave Airlie
@ 2020-10-06 10:29 ` Christian König
  5 siblings, 0 replies; 11+ messages in thread
From: Christian König @ 2020-10-06 10:29 UTC (permalink / raw)
  To: Dave Airlie, dri-devel; +Cc: rscheidegger.oss

Patches #1-#4 Acked-by: Christian König <cristian.koenig@amd.com>

Patch #5 Reviewed-by: Christian König <christian.koenig@amd.com>

Am 06.10.20 um 02:06 schrieb Dave Airlie:
> I've just pulled out the few bits for making the move callback compulsory
> from my previous series.
>
> The vmwgfx ones need acks/r-bs, I've booted them in vmplayer and they
> seem to work fine.
>
> Dave.
>
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/5] drm/vmwgfx: move null mem checks outside move notifies
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Zack Rusin @ 2020-10-08  3:39 UTC (permalink / raw)
  To: Dave Airlie; +Cc: rscheidegger.oss, christian.koenig, dri-devel


> On Oct 5, 2020, at 20:06, Dave Airlie <airlied@gmail.com> wrote:
> 
> From: Dave Airlie <airlied@redhat.com>
> 
> Both fns checked mem == NULL, just move the check outside.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

That’s a nice cleanup.

Reviewed-by: Zack Rusin <zackr@vmware.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] drm/vmwgfx: add a move callback.
  2020-10-06  0:06 ` [PATCH 3/5] drm/vmwgfx: add a move callback Dave Airlie
@ 2020-10-08  3:41   ` Zack Rusin
  2020-10-08  4:02     ` Dave Airlie
  2020-10-08 15:35   ` Roland Scheidegger
  1 sibling, 1 reply; 11+ messages in thread
From: Zack Rusin @ 2020-10-08  3:41 UTC (permalink / raw)
  To: Dave Airlie; +Cc: rscheidegger.oss, christian.koenig, dri-devel


> On Oct 5, 2020, at 20:06, Dave Airlie <airlied@gmail.com> wrote:
> 
> 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>

What are your plans for it? i.e. how is it going to be different?

Reviewed-by: Zack Rusin <zackr@vmware.com>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] drm/vmwgfx: add a move callback.
  2020-10-08  3:41   ` Zack Rusin
@ 2020-10-08  4:02     ` Dave Airlie
  0 siblings, 0 replies; 11+ messages in thread
From: Dave Airlie @ 2020-10-08  4:02 UTC (permalink / raw)
  To: Zack Rusin; +Cc: rscheidegger.oss, christian.koenig, dri-devel

On Thu, 8 Oct 2020 at 13:41, Zack Rusin <zackr@vmware.com> wrote:
>
>
> > On Oct 5, 2020, at 20:06, Dave Airlie <airlied@gmail.com> wrote:
> >
> > 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>
>
> What are your plans for it? i.e. how is it going to be different?

Initial plan is to put move_notify inside the move callback, then
eventually get rid of the ttm bind/unbind callback and let the driver
do that itself if needed.

I've got most of it in a branch (and I posted a 45 patch series a week
or two ago), but I need to rebase and clean it up for reposting.

Dave.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] drm/vmwgfx: add a move callback.
  2020-10-06  0:06 ` [PATCH 3/5] drm/vmwgfx: add a move callback Dave Airlie
  2020-10-08  3:41   ` Zack Rusin
@ 2020-10-08 15:35   ` Roland Scheidegger
  1 sibling, 0 replies; 11+ messages in thread
From: Roland Scheidegger @ 2020-10-08 15:35 UTC (permalink / raw)
  To: Dave Airlie, dri-devel; +Cc: christian.koenig

Both vmwgxf patches look good to me too.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>

Am 06.10.20 um 02:06 schrieb Dave Airlie:
> 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,
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-10-08 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/5] drm/vmwgfx: add a move callback Dave Airlie
2020-10-08  3:41   ` 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

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).