From 37487adc19edc027096faad5b1bbd3565415b7bf Mon Sep 17 00:00:00 2001 From: "hyesoo.yu" Date: Tue, 19 Dec 2017 18:50:27 +0900 Subject: [PATCH] [COMMON] g2d: kill the task when the invalid condition kill the task and show the debugging information when every tasks pushed to g2d H/W are queued. Change-Id: Id0c26c37979936b9b0942364438f9899c17e013a Signed-off-by: hyesoo.yu --- drivers/gpu/exynos/g2d/g2d_drv.c | 3 ++- drivers/gpu/exynos/g2d/g2d_regs.c | 26 ++++++++++++++++++++++++++ drivers/gpu/exynos/g2d/g2d_regs.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/exynos/g2d/g2d_drv.c b/drivers/gpu/exynos/g2d/g2d_drv.c index bf862132f7ae..1465d10435fa 100644 --- a/drivers/gpu/exynos/g2d/g2d_drv.c +++ b/drivers/gpu/exynos/g2d/g2d_drv.c @@ -113,7 +113,8 @@ void g2d_hw_timeout_handler(unsigned long arg) mod_timer(&task->timer, jiffies + msecs_to_jiffies(G2D_HW_TIMEOUT_MSEC)); - if (job_state != G2D_JOB_STATE_RUNNING) + if (!g2d_hw_stuck_state(g2d_dev) && + (job_state != G2D_JOB_STATE_RUNNING)) /* G2D_JOB_STATE_QUEUEING or G2D_JOB_STATE_SUSPENDING */ /* Time out is not caused by this task */ goto out; diff --git a/drivers/gpu/exynos/g2d/g2d_regs.c b/drivers/gpu/exynos/g2d/g2d_regs.c index 1d1b35c4f159..acc61c1ce3fd 100644 --- a/drivers/gpu/exynos/g2d/g2d_regs.c +++ b/drivers/gpu/exynos/g2d/g2d_regs.c @@ -85,6 +85,32 @@ void g2d_hw_push_task(struct g2d_device *g2d_dev, struct g2d_task *task) } #endif +bool g2d_hw_stuck_state(struct g2d_device *g2d_dev) +{ + int i, val; + int retry_count = 10; + + while (retry_count-- > 0) { + for (i = 0; i < G2D_MAX_JOBS; i++) { + val = readl_relaxed( + g2d_dev->reg + G2D_JOB_IDn_STATE_REG(i)); + + val &= G2D_JOB_STATE_MASK; + + if ((i < MAX_SHARED_BUF_NUM) && + (val == G2D_JOB_STATE_RUNNING)) + return false; + + /* if every task are queued except hwfc job*/ + if ((i >= MAX_SHARED_BUF_NUM) && + (val != G2D_JOB_STATE_QUEUEING)) + return false; + } + } + + return true; +} + static const char *error_desc[3] = { "AFBC Stuck", "No read response", diff --git a/drivers/gpu/exynos/g2d/g2d_regs.h b/drivers/gpu/exynos/g2d/g2d_regs.h index f0d87d074ad9..4bae0619adf0 100644 --- a/drivers/gpu/exynos/g2d/g2d_regs.h +++ b/drivers/gpu/exynos/g2d/g2d_regs.h @@ -91,6 +91,7 @@ /* Fields of G2D_HWFC_CAPTURE_IDX_REG */ #define G2D_HWFC_CAPTURE_HWFC_JOB (1 << 8) +bool g2d_hw_stuck_state(struct g2d_device *g2d_dev); void g2d_hw_push_task(struct g2d_device *g2d_dev, struct g2d_task *task); int g2d_hw_get_current_task(struct g2d_device *g2d_dev); void g2d_hw_kill_task(struct g2d_device *g2d_dev, unsigned int job_id); -- 2.20.1