On Tue, Jun 4, 2019 at 12:07 PM S, Shirish <Shirish.S@xxxxxxx> wrote: > > [What] > readptr read always returns zero, since most likely > UVD block is either power or clock gated. > > [How] > fetch rptr after amdgpu_ring_alloc() which informs > the power management code that the block is about to be > used and hence the gating is turned off. > > Signed-off-by: Louis Li <Ching-shih.Li@xxxxxxx> > Signed-off-by: Shirish S <shirish.s@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 +++- > drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 5 ++++- > drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 5 ++++- What about uvd 4.2, 5.0 and VCE 2.0, 3.0, 4.0? Alex > 3 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c > index 118451f..d786098 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c > @@ -468,7 +468,7 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout) > int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring) > { > struct amdgpu_device *adev = ring->adev; > - uint32_t rptr = amdgpu_ring_get_rptr(ring); > + uint32_t rptr; > unsigned i; > int r; > > @@ -476,6 +476,8 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring) > if (r) > return r; > > + rptr = amdgpu_ring_get_rptr(ring); > + > amdgpu_ring_write(ring, VCN_ENC_CMD_END); > amdgpu_ring_commit(ring); > > diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > index c61a314..16682b7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > @@ -170,13 +170,16 @@ static void uvd_v6_0_enc_ring_set_wptr(struct amdgpu_ring *ring) > static int uvd_v6_0_enc_ring_test_ring(struct amdgpu_ring *ring) > { > struct amdgpu_device *adev = ring->adev; > - uint32_t rptr = amdgpu_ring_get_rptr(ring); > + uint32_t rptr; > unsigned i; > int r; > > r = amdgpu_ring_alloc(ring, 16); > if (r) > return r; > + > + rptr = amdgpu_ring_get_rptr(ring); > + > amdgpu_ring_write(ring, HEVC_ENC_CMD_END); > amdgpu_ring_commit(ring); > > diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c > index cdb96d4..74811b2 100644 > --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c > @@ -175,7 +175,7 @@ static void uvd_v7_0_enc_ring_set_wptr(struct amdgpu_ring *ring) > static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring) > { > struct amdgpu_device *adev = ring->adev; > - uint32_t rptr = amdgpu_ring_get_rptr(ring); > + uint32_t rptr; > unsigned i; > int r; > > @@ -185,6 +185,9 @@ static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring) > r = amdgpu_ring_alloc(ring, 16); > if (r) > return r; > + > + rptr = amdgpu_ring_get_rptr(ring); > + > amdgpu_ring_write(ring, HEVC_ENC_CMD_END); > amdgpu_ring_commit(ring); > > -- > 2.7.4 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx