]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/amdgpu/vce: VCE entity initialization relies on ring initializtion
authorEmily Deng <Emily.Deng@amd.com>
Mon, 13 Aug 2018 06:46:06 +0000 (14:46 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Aug 2018 22:21:29 +0000 (17:21 -0500)
Entity init should after ring init, as the entity's sched_rq's initialization
is in ring init.

SWDEV-161495

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

index b6ab4f5350c8098836c5f6758f2ef2387efea596..0cc5190f4f36e4a1b192a17b274bbd4fe38c00b6 100644 (file)
@@ -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;
@@ -235,6 +225,29 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)
        return 0;
 }
 
+/**
+ * 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
  *
index 71781267ee4c00d7ceb7c5271c7f809503c1a1ec..a1f209eed4c477498ee932a0f02e47fdff993137 100644 (file)
@@ -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,
index d48e877b682e8f1ba18ed7d659c83229cfb94e8f..7eaa54ba016b7848fc3c5f09697407599eac2fd8 100644 (file)
@@ -439,6 +439,8 @@ static int vce_v2_0_sw_init(void *handle)
                        return r;
        }
 
+       r = amdgpu_vce_entity_init(adev);
+
        return r;
 }
 
index cc6ce6cc03f47968345e6afe0d44003308ed2ecf..c8390f9adfd6ce750e1deb179692d0a5cdc3867c 100644 (file)
@@ -448,6 +448,8 @@ static int vce_v3_0_sw_init(void *handle)
                        return r;
        }
 
+       r = amdgpu_vce_entity_init(adev);
+
        return r;
 }
 
index 65f8860169e95b4030b97c4c8de563e21c93dfe5..6faeb17fc71c4d0ad58cf4d4f9637df216fbe0d0 100644 (file)
@@ -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;