summaryrefslogtreecommitdiffstats
path: root/bsp/meta-synopsys/recipes-kernel/linux/linux-arc/0010-UDL-defio-add-fb-lock-and-required-checks.patch
blob: 9c52b94018d7f5b5af44fb9c8e12738e3909bf42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From f781b63e277a7bc821d9c3415bc84d3e075d5591 Mon Sep 17 00:00:00 2001
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Date: Wed, 19 Sep 2018 16:57:32 +0300
Subject: [PATCH] UDL: defio: add fb lock and required checks

Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
---
 drivers/gpu/drm/udl/udl_modeset.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
index 10794ce2619c..df30b81abf7a 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -27,12 +27,26 @@ static void pal_modeset_damage(struct drm_device *dev)
 {
 	struct udl_device *udl = dev->dev_private;
 	struct udl_framebuffer *ufb;
+	struct drm_framebuffer *fb;
 
-	if (!udl->crtc || !udl->crtc->primary->fb)
+	if (!udl) {
+	pr_warn("  PAL: UDL: no udl! %s:%d", __func__, __LINE__);
+		return;
+	}
+
+	if (!udl->crtc || !udl->crtc->primary)
 		return;
 
+       fb = udl->crtc->primary->fb;
+       if (!fb)
+               return;
+
+       drm_modeset_lock_all(fb->dev);
+
 	ufb = to_udl_fb(udl->crtc->primary->fb);
 	udl_handle_damage(ufb, 0, 0, ufb->base.width, ufb->base.height);
+
+       drm_modeset_unlock_all(fb->dev);
 }
 
 static void pal_deferred_io_work(struct work_struct *work)
@@ -44,6 +58,8 @@ static void pal_deferred_io_work(struct work_struct *work)
 static void pal_deferred_io_cleanup(void)
 {
 	cancel_delayed_work_sync(&deferred_work);
+
+       pr_info("  PAL: UDL: cancel deferred io! %s:%d", __func__, __LINE__);
 }
 
 static void pal_deferred_io_init(struct drm_device *dev)
-- 
2.16.2