From: hyesoo.yu Date: Wed, 27 Dec 2017 01:42:01 +0000 (+0900) Subject: [COMMON] g2d: remove from qos contexts on release X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7607b17d2374093e50f6d4cc87cda0eceff29a0f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] g2d: remove from qos contexts on release Context should be removed from qos context to prevent access after being removed on release although g2d still needs performance Change-Id: Id4dae0f3dc7d142c95c5e6de50503f3857289830 Signed-off-by: hyesoo.yu --- diff --git a/drivers/gpu/exynos/g2d/g2d_drv.c b/drivers/gpu/exynos/g2d/g2d_drv.c index 7088416c466d..bf862132f7ae 100644 --- a/drivers/gpu/exynos/g2d/g2d_drv.c +++ b/drivers/gpu/exynos/g2d/g2d_drv.c @@ -254,7 +254,7 @@ static void g2d_timeout_perf_work(struct work_struct *work) struct g2d_context *ctx = container_of(work, struct g2d_context, dwork.work); - g2d_put_performance(ctx); + g2d_put_performance(ctx, false); } static int g2d_open(struct inode *inode, struct file *filp) @@ -302,7 +302,7 @@ static int g2d_release(struct inode *inode, struct file *filp) kfree(g2d_ctx->hwfc_info); } - g2d_put_performance(g2d_ctx); + g2d_put_performance(g2d_ctx, true); kfree(g2d_ctx); @@ -439,7 +439,7 @@ static long g2d_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ret = -EFAULT; break; } - g2d_set_performance(ctx, &data); + g2d_set_performance(ctx, &data, false); break; } diff --git a/drivers/gpu/exynos/g2d/g2d_perf.c b/drivers/gpu/exynos/g2d/g2d_perf.c index 20fa02c5202c..fa7f1f5fd300 100644 --- a/drivers/gpu/exynos/g2d/g2d_perf.c +++ b/drivers/gpu/exynos/g2d/g2d_perf.c @@ -238,7 +238,7 @@ static void g2d_set_qos_frequency(struct g2d_context *g2d_ctx, } void g2d_set_performance(struct g2d_context *ctx, - struct g2d_performance_data *data) + struct g2d_performance_data *data, bool release) { struct g2d_device *g2d_dev = ctx->g2d_dev; int i; @@ -254,7 +254,7 @@ void g2d_set_performance(struct g2d_context *ctx, mutex_lock(&g2d_dev->lock_qos); if (!data->num_frame) { - if (g2d_still_need_perf(g2d_dev)) { + if (g2d_still_need_perf(g2d_dev) && !release) { mutex_unlock(&g2d_dev->lock_qos); return; } @@ -270,11 +270,11 @@ void g2d_set_performance(struct g2d_context *ctx, mutex_unlock(&g2d_dev->lock_qos); } -void g2d_put_performance(struct g2d_context *ctx) +void g2d_put_performance(struct g2d_context *ctx, bool release) { struct g2d_performance_data data; data.num_frame = 0; - g2d_set_performance(ctx, &data); + g2d_set_performance(ctx, &data, release); } diff --git a/drivers/gpu/exynos/g2d/g2d_perf.h b/drivers/gpu/exynos/g2d/g2d_perf.h index 58fcb74b660a..96c813292242 100644 --- a/drivers/gpu/exynos/g2d/g2d_perf.h +++ b/drivers/gpu/exynos/g2d/g2d_perf.h @@ -29,7 +29,7 @@ struct g2d_performance_data; #define BTS_PEAK_FPS_RATIO 1667 void g2d_set_performance(struct g2d_context *ctx, - struct g2d_performance_data *data); -void g2d_put_performance(struct g2d_context *ctx); + struct g2d_performance_data *data, bool release); +void g2d_put_performance(struct g2d_context *ctx, bool release); #endif /* _G2D_PERF_H_ */