All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook
@ 2019-07-25 13:26 Daniel Vetter
  2019-07-25 13:26 ` [PATCH 1/4] drm/radeon: Fill out gem_object->resv Daniel Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-07-25 13:26 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, kraxel

Hi all,

Resending this little patch series (everything else landed now), so that
we can move forward with Gerd's series to embed a gem_bo in the ttm_bo (he
rebased on top of this).

Review/testing much appreciated.

Thanks, Daniel

Daniel Vetter (4):
  drm/radeon: Fill out gem_object->resv
  drm/nouveau: Fill out gem_object->resv
  drm/amdgpu: Fill out gem_object->resv
  drm/prime: Ditch gem_prime_res_obj hook

 Documentation/gpu/todo.rst                  |  9 ---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 17 +----------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |  2 ++
 drivers/gpu/drm/drm_prime.c                 |  3 ---
 drivers/gpu/drm/nouveau/nouveau_bo.c        |  2 ++
 drivers/gpu/drm/nouveau/nouveau_drm.c       |  1 -
 drivers/gpu/drm/nouveau/nouveau_gem.h       |  1 -
 drivers/gpu/drm/nouveau/nouveau_prime.c     |  7 -------
 drivers/gpu/drm/radeon/radeon_drv.c         |  2 --
 drivers/gpu/drm/radeon/radeon_object.c      |  1 +
 drivers/gpu/drm/radeon/radeon_prime.c       |  7 -------
 include/drm/drm_drv.h                       | 12 ------------
 14 files changed, 6 insertions(+), 60 deletions(-)

-- 
2.22.0

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

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

* [PATCH 1/4] drm/radeon: Fill out gem_object->resv
  2019-07-25 13:26 [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook Daniel Vetter
@ 2019-07-25 13:26 ` Daniel Vetter
       [not found]   ` <20190725132655.11951-2-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
       [not found] ` <20190725132655.11951-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2019-07-25 13:26 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, amd-gfx, kraxel, Alex Deucher, Daniel Vetter,
	Christian König, Emil Velikov

That way we can ditch our gem_prime_res_obj implementation. Since ttm
absolutely needs the right reservation object all the boilerplate is
already there and we just have to wire it up correctly.

Note that gem/prime doesn't care when we do this, as long as we do it
before the bo is registered and someone can call the handle2fd ioctl
on it.

Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
of always passing a non-NULL resv to ttm_bo_init(). At least for gem
drivers that would avoid having two of these, on in ttm_buffer_object
and the other in drm_gem_object, one just there for confusion.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/radeon/radeon_drv.c    | 2 --
 drivers/gpu/drm/radeon/radeon_object.c | 1 +
 drivers/gpu/drm/radeon/radeon_prime.c  | 7 -------
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 4403e76e1ae0..a4a78dfdef37 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -152,7 +152,6 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
 							struct sg_table *sg);
 int radeon_gem_prime_pin(struct drm_gem_object *obj);
 void radeon_gem_prime_unpin(struct drm_gem_object *obj);
-struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *);
 void *radeon_gem_prime_vmap(struct drm_gem_object *obj);
 void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
 
@@ -566,7 +565,6 @@ static struct drm_driver kms_driver = {
 	.gem_prime_export = radeon_gem_prime_export,
 	.gem_prime_pin = radeon_gem_prime_pin,
 	.gem_prime_unpin = radeon_gem_prime_unpin,
-	.gem_prime_res_obj = radeon_gem_prime_res_obj,
 	.gem_prime_get_sg_table = radeon_gem_prime_get_sg_table,
 	.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
 	.gem_prime_vmap = radeon_gem_prime_vmap,
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 21f73fc86f38..7a2bad843f8a 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -262,6 +262,7 @@ int radeon_bo_create(struct radeon_device *rdev,
 	r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,
 			&bo->placement, page_align, !kernel, acc_size,
 			sg, resv, &radeon_ttm_bo_destroy);
+	bo->gem_base.resv = bo->tbo.resv;
 	up_read(&rdev->pm.mclk_lock);
 	if (unlikely(r != 0)) {
 		return r;
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index deaffce50a2e..8ce3e8045d42 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -117,13 +117,6 @@ void radeon_gem_prime_unpin(struct drm_gem_object *obj)
 }
 
 
-struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj)
-{
-	struct radeon_bo *bo = gem_to_radeon_bo(obj);
-
-	return bo->tbo.resv;
-}
-
 struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
 					int flags)
 {
-- 
2.22.0

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

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

* [PATCH 2/4] drm/nouveau: Fill out gem_object->resv
       [not found] ` <20190725132655.11951-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-07-25 13:26   ` Daniel Vetter
       [not found]     ` <20190725132655.11951-3-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2019-07-25 13:26 UTC (permalink / raw)
  To: DRI Development
  Cc: kraxel-H+wXaHxf7aLQT0dZR+AlfA,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Daniel Vetter,
	Emil Velikov, Ben Skeggs

That way we can ditch our gem_prime_res_obj implementation. Since ttm
absolutely needs the right reservation object all the boilerplate is
already there and we just have to wire it up correctly.

Note that gem/prime doesn't care when we do this, as long as we do it
before the bo is registered and someone can call the handle2fd ioctl
on it.

Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
of always passing a non-NULL resv to ttm_bo_init(). At least for gem
drivers that would avoid having two of these, on in ttm_buffer_object
and the other in drm_gem_object, one just there for confusion.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nouveau_bo.c    | 2 ++
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 1 -
 drivers/gpu/drm/nouveau/nouveau_gem.h   | 1 -
 drivers/gpu/drm/nouveau/nouveau_prime.c | 7 -------
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 34a998012bf6..6f1217b3e6b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -299,6 +299,8 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align,
 			  type, &nvbo->placement,
 			  align >> PAGE_SHIFT, false, acc_size, sg,
 			  robj, nouveau_bo_del_ttm);
+	nvbo->gem.resv = nvbo->bo.resv;
+
 	if (ret) {
 		/* ttm will call nouveau_bo_del_ttm if it fails.. */
 		return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 068ff3ad6ed0..7e045580a3a4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1131,7 +1131,6 @@ driver_stub = {
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_pin = nouveau_gem_prime_pin,
-	.gem_prime_res_obj = nouveau_gem_prime_res_obj,
 	.gem_prime_unpin = nouveau_gem_prime_unpin,
 	.gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table,
 	.gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h
index 03371204a47c..d67e2f9ec59c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.h
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.h
@@ -33,7 +33,6 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
 				  struct drm_file *);
 
 extern int nouveau_gem_prime_pin(struct drm_gem_object *);
-struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *);
 extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
 extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
 extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index 1fefc93af1d7..ec50017692d4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -107,10 +107,3 @@ void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
 
 	nouveau_bo_unpin(nvbo);
 }
-
-struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj)
-{
-	struct nouveau_bo *nvbo = nouveau_gem_object(obj);
-
-	return nvbo->bo.resv;
-}
-- 
2.22.0

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

* [PATCH 3/4] drm/amdgpu: Fill out gem_object->resv
  2019-07-25 13:26 [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook Daniel Vetter
  2019-07-25 13:26 ` [PATCH 1/4] drm/radeon: Fill out gem_object->resv Daniel Vetter
       [not found] ` <20190725132655.11951-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-07-25 13:26 ` Daniel Vetter
  2019-07-25 13:26 ` [PATCH 4/4] drm/prime: Ditch gem_prime_res_obj hook Daniel Vetter
  2019-07-31  8:19 ` [PATCH 0/4] RESEND: ditch " Daniel Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-07-25 13:26 UTC (permalink / raw)
  To: DRI Development
  Cc: Thomas Zimmermann, Amber Lin, Daniel Vetter, Felix Kuehling,
	Michel Dänzer, Samuel Li, Sonny Jiang, Junwei Zhang,
	Huang Rui, Michał Mirosław, kraxel, Alex Deucher,
	Daniel Vetter, Evan Quan, Christian König, Emil Velikov

That way we can ditch our gem_prime_res_obj implementation. Since ttm
absolutely needs the right reservation object all the boilerplate is
already there and we just have to wire it up correctly.

Note that gem/prime doesn't care when we do this, as long as we do it
before the bo is registered and someone can call the handle2fd ioctl
on it.

Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
of always passing a non-NULL resv to ttm_bo_init(). At least for gem
drivers that would avoid having two of these, on in ttm_buffer_object
and the other in drm_gem_object, one just there for confusion.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Michel Dänzer" <michel.daenzer@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Cc: Evan Quan <evan.quan@amd.com>
Cc: Sonny Jiang <sonny.jiang@amd.com>
Cc: Amber Lin <Amber.Lin@amd.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Junwei Zhang <Jerry.Zhang@amd.com>
Cc: Thomas Zimmermann <contact@tzimmermann.org>
Cc: Samuel Li <Samuel.Li@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 17 +----------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |  2 ++
 4 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 4809d4a5d72a..02cd845e77b3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -267,20 +267,6 @@ static void amdgpu_dma_buf_map_detach(struct dma_buf *dma_buf,
 	drm_gem_map_detach(dma_buf, attach);
 }
 
-/**
- * amdgpu_gem_prime_res_obj - &drm_driver.gem_prime_res_obj implementation
- * @obj: GEM BO
- *
- * Returns:
- * The BO's reservation object.
- */
-struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *obj)
-{
-	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-
-	return bo->tbo.resv;
-}
-
 /**
  * amdgpu_dma_buf_begin_cpu_access - &dma_buf_ops.begin_cpu_access implementation
  * @dma_buf: Shared DMA buffer
@@ -339,8 +325,7 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = {
  * @gobj: GEM BO
  * @flags: Flags such as DRM_CLOEXEC and DRM_RDWR.
  *
- * The main work is done by the &drm_gem_prime_export helper, which in turn
- * uses &amdgpu_gem_prime_res_obj.
+ * The main work is done by the &drm_gem_prime_export helper.
  *
  * Returns:
  * Shared DMA buffer representing the GEM BO from the given device.
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
index 7f73a4f94204..5012e6ab58f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
@@ -34,7 +34,6 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj,
 					int flags);
 struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
 					    struct dma_buf *dma_buf);
-struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *);
 void *amdgpu_gem_prime_vmap(struct drm_gem_object *obj);
 void amdgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
 int amdgpu_gem_prime_mmap(struct drm_gem_object *obj,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f67b5baed441..98df55534a6d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1397,7 +1397,6 @@ static struct drm_driver kms_driver = {
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_export = amdgpu_gem_prime_export,
 	.gem_prime_import = amdgpu_gem_prime_import,
-	.gem_prime_res_obj = amdgpu_gem_prime_res_obj,
 	.gem_prime_get_sg_table = amdgpu_gem_prime_get_sg_table,
 	.gem_prime_import_sg_table = amdgpu_gem_prime_import_sg_table,
 	.gem_prime_vmap = amdgpu_gem_prime_vmap,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index bea6f298dfdc..19ec775b7aa8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -509,6 +509,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 	if (unlikely(r != 0))
 		return r;
 
+	bo->gem_base.resv = bo->tbo.resv;
+
 	if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
 	    bo->tbo.mem.mem_type == TTM_PL_VRAM &&
 	    bo->tbo.mem.start < adev->gmc.visible_vram_size >> PAGE_SHIFT)
-- 
2.22.0

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

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

* [PATCH 4/4] drm/prime: Ditch gem_prime_res_obj hook
  2019-07-25 13:26 [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook Daniel Vetter
                   ` (2 preceding siblings ...)
  2019-07-25 13:26 ` [PATCH 3/4] drm/amdgpu: " Daniel Vetter
@ 2019-07-25 13:26 ` Daniel Vetter
  2019-07-31  8:19 ` [PATCH 0/4] RESEND: ditch " Daniel Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-07-25 13:26 UTC (permalink / raw)
  To: DRI Development
  Cc: David Airlie, Daniel Vetter, Maxime Ripard, kraxel,
	Daniel Vetter, Sean Paul, Emil Velikov

Everyone is just using gem_object->resv now.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
---
 Documentation/gpu/todo.rst  |  9 ---------
 drivers/gpu/drm/drm_prime.c |  3 ---
 include/drm/drm_drv.h       | 12 ------------
 3 files changed, 24 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 688b4adbbf62..8e9e9760dbf5 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -196,15 +196,6 @@ Might be good to also have some igt testcases for this.
 
 Contact: Daniel Vetter, Noralf Tronnes
 
-Remove the ->gem_prime_res_obj callback
---------------------------------------------
-
-The ->gem_prime_res_obj callback can be removed from drivers by using the
-reservation_object in the drm_gem_object. It may also be possible to use the
-generic drm_gem_reservation_object_wait helper for waiting for a bo.
-
-Contact: Daniel Vetter
-
 idr_init_base()
 ---------------
 
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index eca484106cc2..0a2316e0e812 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -836,9 +836,6 @@ struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj,
 		.resv = obj->resv,
 	};
 
-	if (dev->driver->gem_prime_res_obj)
-		exp_info.resv = dev->driver->gem_prime_res_obj(obj);
-
 	return drm_gem_dmabuf_export(dev, &exp_info);
 }
 EXPORT_SYMBOL(drm_gem_prime_export);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 9927f4f894ef..380e134c5415 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -618,18 +618,6 @@ struct drm_driver {
 	 */
 	struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
 
-	/**
-	 * @gem_prime_res_obj:
-	 *
-	 * Optional hook to look up the &reservation_object for an buffer when
-	 * exporting it.
-	 *
-	 * FIXME: This hook is deprecated. Users of this hook should be replaced
-	 * by setting &drm_gem_object.resv instead.
-	 */
-	struct reservation_object * (*gem_prime_res_obj)(
-				struct drm_gem_object *obj);
-
 	/**
 	 * @gem_prime_import_sg_table:
 	 *
-- 
2.22.0

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

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

* Re: [PATCH 1/4] drm/radeon: Fill out gem_object->resv
       [not found]   ` <20190725132655.11951-2-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-07-26  6:56     ` Koenig, Christian
  0 siblings, 0 replies; 8+ messages in thread
From: Koenig, Christian @ 2019-07-26  6:56 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Zhou, David(ChunMing),
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	kraxel-H+wXaHxf7aLQT0dZR+AlfA, Deucher, Alexander, Daniel Vetter,
	Emil Velikov

Am 25.07.19 um 15:26 schrieb Daniel Vetter:
> That way we can ditch our gem_prime_res_obj implementation. Since ttm
> absolutely needs the right reservation object all the boilerplate is
> already there and we just have to wire it up correctly.
>
> Note that gem/prime doesn't care when we do this, as long as we do it
> before the bo is registered and someone can call the handle2fd ioctl
> on it.
>
> Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
> of always passing a non-NULL resv to ttm_bo_init(). At least for gem
> drivers that would avoid having two of these, on in ttm_buffer_object
> and the other in drm_gem_object, one just there for confusion.
>
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org

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

> ---
>   drivers/gpu/drm/radeon/radeon_drv.c    | 2 --
>   drivers/gpu/drm/radeon/radeon_object.c | 1 +
>   drivers/gpu/drm/radeon/radeon_prime.c  | 7 -------
>   3 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 4403e76e1ae0..a4a78dfdef37 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -152,7 +152,6 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
>   							struct sg_table *sg);
>   int radeon_gem_prime_pin(struct drm_gem_object *obj);
>   void radeon_gem_prime_unpin(struct drm_gem_object *obj);
> -struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *);
>   void *radeon_gem_prime_vmap(struct drm_gem_object *obj);
>   void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
>   
> @@ -566,7 +565,6 @@ static struct drm_driver kms_driver = {
>   	.gem_prime_export = radeon_gem_prime_export,
>   	.gem_prime_pin = radeon_gem_prime_pin,
>   	.gem_prime_unpin = radeon_gem_prime_unpin,
> -	.gem_prime_res_obj = radeon_gem_prime_res_obj,
>   	.gem_prime_get_sg_table = radeon_gem_prime_get_sg_table,
>   	.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
>   	.gem_prime_vmap = radeon_gem_prime_vmap,
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 21f73fc86f38..7a2bad843f8a 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.c
> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> @@ -262,6 +262,7 @@ int radeon_bo_create(struct radeon_device *rdev,
>   	r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,
>   			&bo->placement, page_align, !kernel, acc_size,
>   			sg, resv, &radeon_ttm_bo_destroy);
> +	bo->gem_base.resv = bo->tbo.resv;
>   	up_read(&rdev->pm.mclk_lock);
>   	if (unlikely(r != 0)) {
>   		return r;
> diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
> index deaffce50a2e..8ce3e8045d42 100644
> --- a/drivers/gpu/drm/radeon/radeon_prime.c
> +++ b/drivers/gpu/drm/radeon/radeon_prime.c
> @@ -117,13 +117,6 @@ void radeon_gem_prime_unpin(struct drm_gem_object *obj)
>   }
>   
>   
> -struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj)
> -{
> -	struct radeon_bo *bo = gem_to_radeon_bo(obj);
> -
> -	return bo->tbo.resv;
> -}
> -
>   struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
>   					int flags)
>   {

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 2/4] drm/nouveau: Fill out gem_object->resv
       [not found]     ` <20190725132655.11951-3-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-07-30 20:54       ` Ben Skeggs
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Skeggs @ 2019-07-30 20:54 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: kraxel-H+wXaHxf7aLQT0dZR+AlfA, ML nouveau, DRI Development,
	Ben Skeggs, Daniel Vetter, Emil Velikov

On Thu, 25 Jul 2019 at 23:27, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> That way we can ditch our gem_prime_res_obj implementation. Since ttm
> absolutely needs the right reservation object all the boilerplate is
> already there and we just have to wire it up correctly.
>
> Note that gem/prime doesn't care when we do this, as long as we do it
> before the bo is registered and someone can call the handle2fd ioctl
> on it.
>
> Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
> of always passing a non-NULL resv to ttm_bo_init(). At least for gem
> drivers that would avoid having two of these, on in ttm_buffer_object
> and the other in drm_gem_object, one just there for confusion.
>
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>

> ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c    | 2 ++
>  drivers/gpu/drm/nouveau/nouveau_drm.c   | 1 -
>  drivers/gpu/drm/nouveau/nouveau_gem.h   | 1 -
>  drivers/gpu/drm/nouveau/nouveau_prime.c | 7 -------
>  4 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 34a998012bf6..6f1217b3e6b9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -299,6 +299,8 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align,
>                           type, &nvbo->placement,
>                           align >> PAGE_SHIFT, false, acc_size, sg,
>                           robj, nouveau_bo_del_ttm);
> +       nvbo->gem.resv = nvbo->bo.resv;
> +
>         if (ret) {
>                 /* ttm will call nouveau_bo_del_ttm if it fails.. */
>                 return ret;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 068ff3ad6ed0..7e045580a3a4 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -1131,7 +1131,6 @@ driver_stub = {
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_pin = nouveau_gem_prime_pin,
> -       .gem_prime_res_obj = nouveau_gem_prime_res_obj,
>         .gem_prime_unpin = nouveau_gem_prime_unpin,
>         .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table,
>         .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h
> index 03371204a47c..d67e2f9ec59c 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_gem.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_gem.h
> @@ -33,7 +33,6 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
>                                   struct drm_file *);
>
>  extern int nouveau_gem_prime_pin(struct drm_gem_object *);
> -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *);
>  extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
>  extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
>  extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
> diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
> index 1fefc93af1d7..ec50017692d4 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_prime.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
> @@ -107,10 +107,3 @@ void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
>
>         nouveau_bo_unpin(nvbo);
>  }
> -
> -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj)
> -{
> -       struct nouveau_bo *nvbo = nouveau_gem_object(obj);
> -
> -       return nvbo->bo.resv;
> -}
> --
> 2.22.0
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

* Re: [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook
  2019-07-25 13:26 [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook Daniel Vetter
                   ` (3 preceding siblings ...)
  2019-07-25 13:26 ` [PATCH 4/4] drm/prime: Ditch gem_prime_res_obj hook Daniel Vetter
@ 2019-07-31  8:19 ` Daniel Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-07-31  8:19 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, kraxel

On Thu, Jul 25, 2019 at 03:26:51PM +0200, Daniel Vetter wrote:
> Hi all,
> 
> Resending this little patch series (everything else landed now), so that
> we can move forward with Gerd's series to embed a gem_bo in the ttm_bo (he
> rebased on top of this).
> 
> Review/testing much appreciated.

Thanks for the reviews, entire series landed now.

Gerd, I think you're good to go on your ttm_bo/gem_bo series.
-Daniel

> 
> Thanks, Daniel
> 
> Daniel Vetter (4):
>   drm/radeon: Fill out gem_object->resv
>   drm/nouveau: Fill out gem_object->resv
>   drm/amdgpu: Fill out gem_object->resv
>   drm/prime: Ditch gem_prime_res_obj hook
> 
>  Documentation/gpu/todo.rst                  |  9 ---------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 17 +----------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |  1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c     |  1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |  2 ++
>  drivers/gpu/drm/drm_prime.c                 |  3 ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c        |  2 ++
>  drivers/gpu/drm/nouveau/nouveau_drm.c       |  1 -
>  drivers/gpu/drm/nouveau/nouveau_gem.h       |  1 -
>  drivers/gpu/drm/nouveau/nouveau_prime.c     |  7 -------
>  drivers/gpu/drm/radeon/radeon_drv.c         |  2 --
>  drivers/gpu/drm/radeon/radeon_object.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_prime.c       |  7 -------
>  include/drm/drm_drv.h                       | 12 ------------
>  14 files changed, 6 insertions(+), 60 deletions(-)
> 
> -- 
> 2.22.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-07-31  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 13:26 [PATCH 0/4] RESEND: ditch gem_prime_res_obj hook Daniel Vetter
2019-07-25 13:26 ` [PATCH 1/4] drm/radeon: Fill out gem_object->resv Daniel Vetter
     [not found]   ` <20190725132655.11951-2-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2019-07-26  6:56     ` Koenig, Christian
     [not found] ` <20190725132655.11951-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2019-07-25 13:26   ` [PATCH 2/4] drm/nouveau: " Daniel Vetter
     [not found]     ` <20190725132655.11951-3-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2019-07-30 20:54       ` Ben Skeggs
2019-07-25 13:26 ` [PATCH 3/4] drm/amdgpu: " Daniel Vetter
2019-07-25 13:26 ` [PATCH 4/4] drm/prime: Ditch gem_prime_res_obj hook Daniel Vetter
2019-07-31  8:19 ` [PATCH 0/4] RESEND: ditch " Daniel Vetter

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.