msm: sde: Wait for Rotator HW complete if stop streaming timeout

SDE rotator commit handler is running under workqueue, and it is
possible that it gets blocked longer than the expected timeout setting
in fence timeout and stream stop timeout. In the case of stream stop
wait timeout, it is important to wait for the rotator commit handler
finished by issuing a cancel request, to ensure buffer resources are
safe to release in the V4L2 framework.

CRs-Fixed: 2013724
Change-Id: I40bbbd8072bf6d0bf1f0d61cc1668a431b12f707
Signed-off-by: Benjamin Chan <bkchan@codeaurora.org>
This commit is contained in:
Benjamin Chan 2017-03-01 17:40:20 -05:00
parent 712414ecaa
commit ca14424a1a
3 changed files with 9 additions and 2 deletions

View file

@ -1975,7 +1975,7 @@ static void sde_rotator_cancel_request(struct sde_rot_mgr *mgr,
devm_kfree(&mgr->pdev->dev, req); devm_kfree(&mgr->pdev->dev, req);
} }
static void sde_rotator_cancel_all_requests(struct sde_rot_mgr *mgr, void sde_rotator_cancel_all_requests(struct sde_rot_mgr *mgr,
struct sde_rot_file_private *private) struct sde_rot_file_private *private)
{ {
struct sde_rot_entry_container *req, *req_next; struct sde_rot_entry_container *req, *req_next;

View file

@ -428,6 +428,9 @@ int sde_rotator_validate_request(struct sde_rot_mgr *rot_dev,
int sde_rotator_clk_ctrl(struct sde_rot_mgr *mgr, int enable); int sde_rotator_clk_ctrl(struct sde_rot_mgr *mgr, int enable);
void sde_rotator_cancel_all_requests(struct sde_rot_mgr *mgr,
struct sde_rot_file_private *private);
static inline void sde_rot_mgr_lock(struct sde_rot_mgr *mgr) static inline void sde_rot_mgr_lock(struct sde_rot_mgr *mgr)
{ {
mutex_lock(&mgr->lock); mutex_lock(&mgr->lock);

View file

@ -457,11 +457,15 @@ static void sde_rotator_stop_streaming(struct vb2_queue *q)
(atomic_read(&ctx->command_pending) == 0), (atomic_read(&ctx->command_pending) == 0),
msecs_to_jiffies(rot_dev->streamoff_timeout)); msecs_to_jiffies(rot_dev->streamoff_timeout));
mutex_lock(q->lock); mutex_lock(q->lock);
if (!ret) if (!ret) {
SDEDEV_ERR(rot_dev->dev, SDEDEV_ERR(rot_dev->dev,
"timeout to stream off s:%d t:%d p:%d\n", "timeout to stream off s:%d t:%d p:%d\n",
ctx->session_id, q->type, ctx->session_id, q->type,
atomic_read(&ctx->command_pending)); atomic_read(&ctx->command_pending));
sde_rot_mgr_lock(rot_dev->mgr);
sde_rotator_cancel_all_requests(rot_dev->mgr, ctx->private);
sde_rot_mgr_unlock(rot_dev->mgr);
}
sde_rotator_return_all_buffers(q, VB2_BUF_STATE_ERROR); sde_rotator_return_all_buffers(q, VB2_BUF_STATE_ERROR);