From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Leo Liu <leo.liu@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: add JPEG check to VCN idle handler and begin use
Date: Thu, 12 Dec 2019 09:18:30 +0100 [thread overview]
Message-ID: <05c7579c-d373-1367-35cc-e1f5f69dc7a4@gmail.com> (raw)
In-Reply-To: <20191211194824.11146-1-leo.liu@amd.com>
Am 11.12.19 um 20:48 schrieb Leo Liu:
> Since it's only needed with VCN1.0 when HW has no its
> own JPEG HW IP block
Wouldn't it be simpler/cleaner to just define a
vcn_v1_0_ring_begin_use() and vcn_v1_0_idle_work_handler() instead?
Regards,
Christian.
>
> Signed-off-by: Leo Liu <leo.liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++----------
> drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 2 ++
> 2 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> index 428cfd58b37d..95ac721f2de0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> @@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
> }
> }
>
> + adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
> + true : false;
> +
> return 0;
> }
>
> @@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
> else
> new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
>
> - if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
> - new_state.jpeg = VCN_DPG_STATE__PAUSE;
> - else
> - new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
> -
> + if (!adev->vcn.has_jpeg_block) {
> + if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
> + new_state.jpeg = VCN_DPG_STATE__PAUSE;
> + else
> + new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
> + }
> adev->vcn.pause_dpg_mode(adev, &new_state);
> }
>
> - fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
> + if (!adev->vcn.has_jpeg_block)
> + fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
> fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
> fences += fence[j];
> }
> @@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
> else
> new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
>
> - if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
> - new_state.jpeg = VCN_DPG_STATE__PAUSE;
> - else
> - new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
> + if (!adev->vcn.has_jpeg_block) {
> + if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
> + new_state.jpeg = VCN_DPG_STATE__PAUSE;
> + else
> + new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
> + }
>
> if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
> new_state.fw_based = VCN_DPG_STATE__PAUSE;
> - else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
> + else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
> new_state.jpeg = VCN_DPG_STATE__PAUSE;
>
> adev->vcn.pause_dpg_mode(adev, &new_state);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
> index 402a5046b985..9a2381d006c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
> @@ -192,6 +192,8 @@ struct amdgpu_vcn {
> unsigned harvest_config;
> int (*pause_dpg_mode)(struct amdgpu_device *adev,
> struct dpg_pause_state *new_state);
> +
> + bool has_jpeg_block;
> };
>
> int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-12-12 8:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 19:48 [PATCH] drm/amdgpu: add JPEG check to VCN idle handler and begin use Leo Liu
2019-12-11 19:52 ` Alex Deucher
2019-12-11 20:01 ` Zhang, Boyuan
2019-12-12 8:18 ` Christian König [this message]
2019-12-12 15:57 ` Leo Liu
2019-12-12 15:58 ` Christian König
2019-12-12 16:06 ` [PATCH 1/2] drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs Leo Liu
2019-12-12 16:06 ` [PATCH 2/2] drm/amdgpu/vcn: remove JPEG related code from idle handler and begin use Leo Liu
2019-12-12 17:59 ` [PATCH 1/2] drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs James Zhu
2019-12-13 10:15 ` Christian König
2019-12-13 14:42 ` Leo Liu
2019-12-13 15:30 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05c7579c-d373-1367-35cc-e1f5f69dc7a4@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=leo.liu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.