drm/amdgpu: use separate scheduler entity for VCE submissions
authorChristian König <christian.koenig@amd.com>
Wed, 10 Feb 2016 16:43:00 +0000 (17:43 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 12 Feb 2016 20:41:01 +0000 (15:41 -0500)
This allows us to remove the kernel context and use a better
priority for the submissions.

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

index cecb5f4328c9decf5900acd8af8856bb5650a52e..4654beac7e706d15a7b5b878e11f3d7533952950 100644 (file)
@@ -1669,6 +1669,7 @@ struct amdgpu_vce {
        struct amdgpu_ring      ring[AMDGPU_MAX_VCE_RINGS];
        struct amdgpu_irq_src   irq;
        unsigned                harvest_config;
+       struct amd_sched_entity entity;
 };
 
 /*
index 8a3119379cd8dc23557da14d6c23ad0d37d5e073..39c3aa60381a58645df8610c830ac7245568079f 100644 (file)
@@ -74,6 +74,8 @@ 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 amd_sched_rq *rq;
        const char *fw_name;
        const struct common_firmware_header *hdr;
        unsigned ucode_version, version_major, version_minor, binary_id;
@@ -170,6 +172,16 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
                return r;
        }
 
+
+       ring = &adev->vce.ring[0];
+       rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
+       r = amd_sched_entity_init(&ring->sched, &adev->vce.entity,
+                                 rq, amdgpu_sched_jobs);
+       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;
@@ -190,6 +202,8 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)
        if (adev->vce.vcpu_bo == NULL)
                return 0;
 
+       amd_sched_entity_fini(&adev->vce.ring[0].sched, &adev->vce.entity);
+
        amdgpu_bo_unref(&adev->vce.vcpu_bo);
 
        amdgpu_ring_fini(&adev->vce.ring[0]);
@@ -481,7 +495,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
 
                amdgpu_job_free(job);
        } else {
-               r = amdgpu_job_submit(job, ring, NULL,
+               r = amdgpu_job_submit(job, ring, &ring->adev->vce.entity,
                                      AMDGPU_FENCE_OWNER_UNDEFINED, &f);
                if (r)
                        goto err;