[COMMON] g2d: remove from qos contexts on release
authorhyesoo.yu <hyesoo.yu@samsung.com>
Wed, 27 Dec 2017 01:42:01 +0000 (10:42 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:27:59 +0000 (14:27 +0900)
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 <hyesoo.yu@samsung.com>
drivers/gpu/exynos/g2d/g2d_drv.c
drivers/gpu/exynos/g2d/g2d_perf.c
drivers/gpu/exynos/g2d/g2d_perf.h

index 7088416c466d34550fad1e2a535a5c1f232bee76..bf862132f7ae6919a6f21c61c9c10f08dcfe0ba8 100644 (file)
@@ -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;
        }
index 20fa02c5202c021fef9e5ce45ffe770634e6853b..fa7f1f5fd3008d6aa5307664fd55b626b744a40b 100644 (file)
@@ -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);
 }
index 58fcb74b660a9b9be43bad2d92bc23a80e980ef2..96c813292242c68b52c320849e7852e43284a6dd 100644 (file)
@@ -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_ */