[PATCH 23/24] drm/radeon: keep the cs relocs inside the ib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian König <deathsimple@xxxxxxxxxxx>

Free them wenn the ib is freed, another
step to better debugging.

Signed-off-by: Christian König <deathsimple@xxxxxxxxxxx>
---
 drivers/gpu/drm/radeon/radeon.h      |    3 +++
 drivers/gpu/drm/radeon/radeon_cs.c   |   14 ++++++++++++--
 drivers/gpu/drm/radeon/radeon_ring.c |    3 +++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 6377f8c..7b2125b 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -567,6 +567,7 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc);
 /*
  * CP & rings.
  */
+struct radeon_cs_reloc;
 
 struct radeon_ib {
 	struct radeon_sa_bo	sa_bo;
@@ -576,6 +577,8 @@ struct radeon_ib {
 	struct radeon_fence	*fence;
 	unsigned		vm_id;
 	bool			is_const_ib;
+	unsigned		nrelocs;
+	struct radeon_cs_reloc	*relocs;
 };
 
 struct radeon_ring {
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 38e1496..ecef708 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -308,7 +308,6 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
 		}
 	}
 	kfree(parser->track);
-	kfree(parser->relocs);
 	kfree(parser->relocs_ptr);
 	for (i = 0; i < parser->nchunks; i++) {
 		kfree(parser->chunks[i].kdata);
@@ -317,7 +316,18 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
 	}
 	kfree(parser->chunks);
 	kfree(parser->chunks_array);
-	radeon_ib_free(parser->rdev, &parser->ib);
+
+	if (parser->ib) {
+		/* keep the relocs for debugging */
+		parser->ib->nrelocs = parser->nrelocs;
+		parser->ib->relocs = parser->relocs;
+
+		/* even if we locally free it the ib stays
+		   alive until it is processed */
+		radeon_ib_free(parser->rdev, &parser->ib);
+	} else {
+		kfree(parser->relocs);
+	}
 }
 
 static int radeon_cs_ib_chunk(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index f256eae..c635aad 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -95,6 +95,8 @@ int radeon_ib_get(struct radeon_device *rdev, int ring,
 	(*ib)->gpu_addr += (*ib)->sa_bo.offset;
 	(*ib)->vm_id = 0;
 	(*ib)->is_const_ib = false;
+	(*ib)->nrelocs = 0;
+	(*ib)->relocs = NULL;
 
 	return 0;
 }
@@ -116,6 +118,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib)
 	if (destroy) {
 		radeon_sa_bo_free(rdev, &tmp->sa_bo);
 		radeon_fence_unref(&tmp->fence);
+		kfree(tmp->relocs);
 		kfree(tmp);
 	}
 }
-- 
1.7.7.6

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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux