Skip to contentSkip to conversation

drm/amdgpu/uvd: UVD entity initialization relys on ring initialization

PATCH In review Emily Deng 2 participants 3 messages Aug 13, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/2 drm/amdgpu/uvd: UVD entity initialization relys on ring initialization

Entity init should after ring init, as the entity's sched_rq's initialization is in ring init.

SWDEV-161495

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 32 +++++++++++++++++++++++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c   |  4 ++++
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c   |  4 ++++
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c   |  2 ++
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c   |  5 +++++
 6 files changed, 39 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +23 -9
index 632fa59..433a741 100644
@@ -122,8 +122,6 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work);
 
 int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 {
-	struct amdgpu_ring *ring;
-	struct drm_sched_rq *rq;
 	unsigned long bo_size;
 	const char *fw_name;
 	const struct common_firmware_header *hdr;
@@ -266,13 +264,6 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 		}
 	}
 
-	ring = &adev->uvd.inst[0].ring;
-	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
-	r = drm_sched_entity_init(&adev->uvd.entity, &rq, 1, NULL);
-	if (r) {
-		DRM_ERROR("Failed setting up UVD kernel entity.\n");
-		return r;
-	}
 	for (i = 0; i < adev->uvd.max_handles; ++i) {
 		atomic_set(&adev->uvd.handles[i], 0);
 		adev->uvd.filp[i] = NULL;
@@ -327,6 +318,29 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev)
 	return 0;
 }
 
+/**
+ * amdgpu_uvd_entity_init - init entity
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+int amdgpu_uvd_entity_init(struct amdgpu_device *adev)
+{
+	struct amdgpu_ring *ring;
+	struct drm_sched_rq *rq;
+	int r;
+
+	ring = &adev->uvd.inst[0].ring;
+	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
+	r = drm_sched_entity_init(&adev->uvd.entity, &rq, 1, NULL);
+	if (r) {
+		DRM_ERROR("Failed setting up UVD kernel entity.\n");
+		return r;
+	}
+
+	return 0;
+}
+
 int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 {
 	unsigned size;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +1 -0
index 33c5f80..a3ab1a4 100644
@@ -69,6 +69,7 @@ struct amdgpu_uvd {
 
 int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
 int amdgpu_uvd_sw_fini(struct amdgpu_device *adev);
+int amdgpu_uvd_entity_init(struct amdgpu_device *adev);
 int amdgpu_uvd_suspend(struct amdgpu_device *adev);
 int amdgpu_uvd_resume(struct amdgpu_device *adev);
 int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +4 -0
index 6fed3d7..8a926d1 100644
@@ -123,6 +123,10 @@ static int uvd_v4_2_sw_init(void *handle)
 	ring = &adev->uvd.inst->ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0);
+	if (r)
+		return r;
+
+	r = amdgpu_uvd_entity_init(adev);
 
 	return r;
 }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4 -0
index aeaa1ca..5024805 100644
@@ -120,6 +120,10 @@ static int uvd_v5_0_sw_init(void *handle)
 	ring = &adev->uvd.inst->ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0);
+	if (r)
+		return r;
+
+	r = amdgpu_uvd_entity_init(adev);
 
 	return r;
 }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
index 598dbea..6ae82cc 100644
@@ -440,6 +440,8 @@ static int uvd_v6_0_sw_init(void *handle)
 		}
 	}
 
+	r = amdgpu_uvd_entity_init(adev);
+
 	return r;
 }
 
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +5 -0
index 5fab356..9b7f846 100644
@@ -410,6 +410,7 @@ static int uvd_v7_0_early_init(void *handle)
 static int uvd_v7_0_sw_init(void *handle)
 {
 	struct amdgpu_ring *ring;
+
 	int i, j, r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
@@ -478,6 +479,10 @@ static int uvd_v7_0_sw_init(void *handle)
 		}
 	}
 
+	r = amdgpu_uvd_entity_init(adev);
+	if (r)
+		return r;
+
 	r = amdgpu_virt_alloc_mm_table(adev);
 	if (r)
 		return r;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1534129843-14571-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu/vce: VCE entity initialization relies on ring initializtion

Entity init should after ring init, as the entity's sched_rq's initialization is in ring init.

SWDEV-161495

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 33 +++++++++++++++++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h |  1 +
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c   |  6 ++++++
 5 files changed, 34 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +23 -10
index b6ab4f5..0cc5190 100644
@@ -90,8 +90,6 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work);
  */
 int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
 {
-	struct amdgpu_ring *ring;
-	struct drm_sched_rq *rq;
 	const char *fw_name;
 	const struct common_firmware_header *hdr;
 	unsigned ucode_version, version_major, version_minor, binary_id;
@@ -188,14 +186,6 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
 		return r;
 	}
 
-	ring = &adev->vce.ring[0];
-	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
-	r = drm_sched_entity_init(&adev->vce.entity, &rq, 1, NULL);
-	if (r != 0) {
-		DRM_ERROR("Failed setting up VCE run queue.\n");
-		return r;
-	}
-
 	for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i) {
 		atomic_set(&adev->vce.handles[i], 0);
 		adev->vce.filp[i] = NULL;
@@ -236,6 +226,29 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)
 }
 
 /**
+ * amdgpu_vce_entity_init - init entity
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+int amdgpu_vce_entity_init(struct amdgpu_device *adev)
+{
+	struct amdgpu_ring *ring;
+	struct drm_sched_rq *rq;
+	int r;
+
+	ring = &adev->vce.ring[0];
+	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
+	r = drm_sched_entity_init(&adev->vce.entity, &rq, 1, NULL);
+	if (r != 0) {
+		DRM_ERROR("Failed setting up VCE run queue.\n");
+		return r;
+	}
+
+	return 0;
+}
+
+/**
  * amdgpu_vce_suspend - unpin VCE fw memory
  *
  * @adev: amdgpu_device pointer
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +1 -0
index 7178126..a1f209e 100644
@@ -55,6 +55,7 @@ struct amdgpu_vce {
 
 int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size);
 int amdgpu_vce_sw_fini(struct amdgpu_device *adev);
+int amdgpu_vce_entity_init(struct amdgpu_device *adev);
 int amdgpu_vce_suspend(struct amdgpu_device *adev);
 int amdgpu_vce_resume(struct amdgpu_device *adev);
 int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
index d48e877..7eaa54b 100644
@@ -439,6 +439,8 @@ static int vce_v2_0_sw_init(void *handle)
 			return r;
 	}
 
+	r = amdgpu_vce_entity_init(adev);
+
 	return r;
 }
 
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -0
index cc6ce6c..c8390f9a 100644
@@ -448,6 +448,8 @@ static int vce_v3_0_sw_init(void *handle)
 			return r;
 	}
 
+	r = amdgpu_vce_entity_init(adev);
+
 	return r;
 }
 
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +6 -0
index 65f8860..6faeb17 100644
@@ -419,6 +419,7 @@ static int vce_v4_0_sw_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_ring *ring;
+
 	unsigned size;
 	int r, i;
 
@@ -474,6 +475,11 @@ static int vce_v4_0_sw_init(void *handle)
 			return r;
 	}
 
+
+	r = amdgpu_vce_entity_init(adev);
+	if (r)
+		return r;
+
 	r = amdgpu_virt_alloc_mm_table(adev);
 	if (r)
 		return r;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#3 lore raw
In reply to a message not in the archive

Am 13.08.2018 um 05:10 schrieb Emily Deng:

Quoted 6 lines

Entity init should after ring init, as the entity's sched_rq's initialization is in ring init.

SWDEV-161495

Quoted 134 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 32 +++++++++++++++++++++++---------
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c   |  4 ++++
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c   |  4 ++++
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c   |  2 ++
  drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c   |  5 +++++
  6 files changed, 39 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +23 -9
index 632fa59..433a741 100644
@@ -122,8 +122,6 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work);
 
  int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
  {
-	struct amdgpu_ring *ring;
-	struct drm_sched_rq *rq;
  	unsigned long bo_size;
  	const char *fw_name;
  	const struct common_firmware_header *hdr;
@@ -266,13 +264,6 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
  		}
  	}
 
-	ring = &adev->uvd.inst[0].ring;
-	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
-	r = drm_sched_entity_init(&adev->uvd.entity, &rq, 1, NULL);
-	if (r) {
-		DRM_ERROR("Failed setting up UVD kernel entity.\n");
-		return r;
-	}
  	for (i = 0; i < adev->uvd.max_handles; ++i) {
  		atomic_set(&adev->uvd.handles[i], 0);
  		adev->uvd.filp[i] = NULL;
@@ -327,6 +318,29 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev)
  	return 0;
  }
 
+/**
+ * amdgpu_uvd_entity_init - init entity
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+int amdgpu_uvd_entity_init(struct amdgpu_device *adev)
+{
+	struct amdgpu_ring *ring;
+	struct drm_sched_rq *rq;
+	int r;
+
+	ring = &adev->uvd.inst[0].ring;
+	rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL];
+	r = drm_sched_entity_init(&adev->uvd.entity, &rq, 1, NULL);
+	if (r) {
+		DRM_ERROR("Failed setting up UVD kernel entity.\n");
+		return r;
+	}
+
+	return 0;
+}
+
  int amdgpu_uvd_suspend(struct amdgpu_device *adev)
  {
  	unsigned size;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +1 -0
index 33c5f80..a3ab1a4 100644
@@ -69,6 +69,7 @@ struct amdgpu_uvd {
 
  int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
  int amdgpu_uvd_sw_fini(struct amdgpu_device *adev);
+int amdgpu_uvd_entity_init(struct amdgpu_device *adev);
  int amdgpu_uvd_suspend(struct amdgpu_device *adev);
  int amdgpu_uvd_resume(struct amdgpu_device *adev);
  int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +4 -0
index 6fed3d7..8a926d1 100644
@@ -123,6 +123,10 @@ static int uvd_v4_2_sw_init(void *handle)
  	ring = &adev->uvd.inst->ring;
  	sprintf(ring->name, "uvd");
  	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0);
+	if (r)
+		return r;
+
+	r = amdgpu_uvd_entity_init(adev);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4 -0
index aeaa1ca..5024805 100644
@@ -120,6 +120,10 @@ static int uvd_v5_0_sw_init(void *handle)
  	ring = &adev->uvd.inst->ring;
  	sprintf(ring->name, "uvd");
  	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0);
+	if (r)
+		return r;
+
+	r = amdgpu_uvd_entity_init(adev);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
index 598dbea..6ae82cc 100644
@@ -440,6 +440,8 @@ static int uvd_v6_0_sw_init(void *handle)
  		}
  	}
 
+	r = amdgpu_uvd_entity_init(adev);
+
  	return r;
  }
 
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +1 -0
index 5fab356..9b7f846 100644
@@ -410,6 +410,7 @@ static int uvd_v7_0_early_init(void *handle)
  static int uvd_v7_0_sw_init(void *handle)
  {
  	struct amdgpu_ring *ring;
+
  	int i, j, r;
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 

drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static int uvd_v7_0_sw_init(void *handle) · line 488

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +4 -0
@@ -478,6 +479,10 @@ static int uvd_v7_0_sw_init(void *handle)
  		}
  	}
 
+	r = amdgpu_uvd_entity_init(adev);
+	if (r)
+		return r;
+
  	r = amdgpu_virt_alloc_mm_table(adev);
  	if (r)
  		return r;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx