Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu/vcn: Allow limiting ctx to instance 0 for AV1 at any time

There is no reason to require this to happen on first submitted IB only.
We need to wait for the queue to be idle, but it can be done at any
time (including when there are multiple video sessions active).

Signed-off-by: David Rosca <david.rosca@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

David Rosca and committed by
Alex Deucher
8908fdce dc8f9f0f

+16 -8
+8 -4
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
··· 1886 1886 struct amdgpu_job *job) 1887 1887 { 1888 1888 struct drm_gpu_scheduler **scheds; 1889 - 1890 - /* The create msg must be in the first IB submitted */ 1891 - if (atomic_read(&job->base.entity->fence_seq)) 1892 - return -EINVAL; 1889 + struct dma_fence *fence; 1893 1890 1894 1891 /* if VCN0 is harvested, we can't support AV1 */ 1895 1892 if (p->adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) 1896 1893 return -EINVAL; 1894 + 1895 + /* wait for all jobs to finish before switching to instance 0 */ 1896 + fence = amdgpu_ctx_get_fence(p->ctx, job->base.entity, ~0ull); 1897 + if (fence) { 1898 + dma_fence_wait(fence, false); 1899 + dma_fence_put(fence); 1900 + } 1897 1901 1898 1902 scheds = p->adev->gpu_sched[AMDGPU_HW_IP_VCN_DEC] 1899 1903 [AMDGPU_RING_PRIO_DEFAULT].sched;
+8 -4
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
··· 1804 1804 struct amdgpu_job *job) 1805 1805 { 1806 1806 struct drm_gpu_scheduler **scheds; 1807 - 1808 - /* The create msg must be in the first IB submitted */ 1809 - if (atomic_read(&job->base.entity->fence_seq)) 1810 - return -EINVAL; 1807 + struct dma_fence *fence; 1811 1808 1812 1809 /* if VCN0 is harvested, we can't support AV1 */ 1813 1810 if (p->adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) 1814 1811 return -EINVAL; 1812 + 1813 + /* wait for all jobs to finish before switching to instance 0 */ 1814 + fence = amdgpu_ctx_get_fence(p->ctx, job->base.entity, ~0ull); 1815 + if (fence) { 1816 + dma_fence_wait(fence, false); 1817 + dma_fence_put(fence); 1818 + } 1815 1819 1816 1820 scheds = p->adev->gpu_sched[AMDGPU_HW_IP_VCN_ENC] 1817 1821 [AMDGPU_RING_PRIO_0].sched;