From 817d9c9d86660b3637d2f998c28f4489e8b3fb27 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Fri, 18 May 2018 12:12:18 +0900 Subject: [PATCH] g2d: add complete support for Exynos9610 commit 46f75b91e ('[COMMON] g2d: add support for Exynos9610') is cherry-picked from the middle of the patch development for the branch android-exynos-4.14-mcd-dev. That is why the above commit is incomplete. So, the rest part of the complete commit to in android-exynos-4.14-mcd-dev is now applied. Change-Id: Ia3b6ea635a24c74425f05d15ba20ff5d85f5c6f1 Signed-off-by: Cho KyongHo --- drivers/gpu/exynos/g2d/g2d_debug.c | 4 ++-- drivers/gpu/exynos/g2d/g2d_fence.c | 2 +- drivers/gpu/exynos/g2d/g2d_perf.c | 2 +- drivers/gpu/exynos/g2d/g2d_task.c | 10 +++++++++- drivers/gpu/exynos/g2d/g2d_task.h | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_debug.c b/drivers/gpu/exynos/g2d/g2d_debug.c index 9c6184f23870..54466c6adec6 100644 --- a/drivers/gpu/exynos/g2d/g2d_debug.c +++ b/drivers/gpu/exynos/g2d/g2d_debug.c @@ -317,8 +317,8 @@ void g2d_dump_sfr(struct g2d_device *g2d_dev, struct g2d_task *task) { unsigned int i, num_array; - num_array = (unsigned int)ARRAY_SIZE(g2d_reg_info) - G2D_MAX_IMAGES - + ((task) ? task->num_source : G2D_MAX_IMAGES); + num_array = (unsigned int)ARRAY_SIZE(g2d_reg_info) - g2d_dev->max_layers + + ((task) ? task->num_source : g2d_dev->max_layers); for (i = 0; i < num_array; i++) { pr_info("[%s: %04X .. %04X]\n", diff --git a/drivers/gpu/exynos/g2d/g2d_fence.c b/drivers/gpu/exynos/g2d/g2d_fence.c index d95eee05d11c..6985d4962189 100644 --- a/drivers/gpu/exynos/g2d/g2d_fence.c +++ b/drivers/gpu/exynos/g2d/g2d_fence.c @@ -163,7 +163,7 @@ struct sync_file *g2d_create_release_fence(struct g2d_device *g2d_dev, { struct dma_fence *fence; struct sync_file *file; - s32 release_fences[G2D_MAX_IMAGES + 1]; + s32 release_fences[g2d_dev->max_layers + 1]; int i; int ret = 0; diff --git a/drivers/gpu/exynos/g2d/g2d_perf.c b/drivers/gpu/exynos/g2d/g2d_perf.c index 560a588e5621..d33dfc180259 100644 --- a/drivers/gpu/exynos/g2d/g2d_perf.c +++ b/drivers/gpu/exynos/g2d/g2d_perf.c @@ -249,7 +249,7 @@ void g2d_set_performance(struct g2d_context *ctx, return; for (i = 0; i < data->num_frame; i++) { - if (data->frame[i].num_layers > G2D_MAX_IMAGES) + if (data->frame[i].num_layers > g2d_dev->max_layers) return; } diff --git a/drivers/gpu/exynos/g2d/g2d_task.c b/drivers/gpu/exynos/g2d/g2d_task.c index 580b80bdb653..1bf054dd47b7 100644 --- a/drivers/gpu/exynos/g2d/g2d_task.c +++ b/drivers/gpu/exynos/g2d/g2d_task.c @@ -384,6 +384,7 @@ void g2d_destroy_tasks(struct g2d_device *g2d_dev) __free_pages(task->cmd_page, get_order(G2D_CMD_LIST_SIZE)); + kfree(task->source); kfree(task); task = next; @@ -403,6 +404,11 @@ static struct g2d_task *g2d_create_task(struct g2d_device *g2d_dev, int id) if (!task) return ERR_PTR(-ENOMEM); + task->source = kcalloc(g2d_dev->max_layers, sizeof(*task->source), + GFP_KERNEL); + if (!task) + goto err_alloc; + INIT_LIST_HEAD(&task->node); task->cmd_page = alloc_pages(GFP_KERNEL, get_order(G2D_CMD_LIST_SIZE)); @@ -418,7 +424,7 @@ static struct g2d_task *g2d_create_task(struct g2d_device *g2d_dev, int id) if (ret) goto err_map; - for (i = 0; i < G2D_MAX_IMAGES; i++) + for (i = 0; i < g2d_dev->max_layers; i++) task->source[i].task = task; task->target.task = task; @@ -430,6 +436,8 @@ static struct g2d_task *g2d_create_task(struct g2d_device *g2d_dev, int id) err_map: __free_pages(task->cmd_page, get_order(G2D_CMD_LIST_SIZE)); err_page: + kfree(task->source); +err_alloc: kfree(task); return ERR_PTR(ret); diff --git a/drivers/gpu/exynos/g2d/g2d_task.h b/drivers/gpu/exynos/g2d/g2d_task.h index a3898d4202aa..b75470e17884 100644 --- a/drivers/gpu/exynos/g2d/g2d_task.h +++ b/drivers/gpu/exynos/g2d/g2d_task.h @@ -94,7 +94,7 @@ struct g2d_task { struct kref starter; struct timer_list timer; - struct g2d_layer source[G2D_MAX_IMAGES]; + struct g2d_layer *source; struct g2d_layer target; unsigned int num_source; -- 2.20.1