summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-openmoko-2.6.32/0012-Fix-dynamic-command-queue-allocation.patch
blob: 68e170a58872950865e5e6818e3a137de29fc118 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From 3b328bfd4aef3ffc9b0192ca512fbc899148e8f5 Mon Sep 17 00:00:00 2001
From: Thomas White <taw@bitwiz.org.uk>
Date: Thu, 6 May 2010 05:40:15 -0700
Subject: [PATCH 12/14] Fix dynamic command queue allocation

(Not tested...)

Signed-off-by: Thomas White <taw@bitwiz.org.uk>
---
 drivers/mfd/glamo/glamo-cmdq.c    |   10 +++++++---
 drivers/mfd/glamo/glamo-cmdq.h    |    2 +-
 drivers/mfd/glamo/glamo-drm-drv.c |   17 +++++++----------
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/mfd/glamo/glamo-cmdq.c b/drivers/mfd/glamo/glamo-cmdq.c
index 442963c..28c5268 100644
--- a/drivers/mfd/glamo/glamo-cmdq.c
+++ b/drivers/mfd/glamo/glamo-cmdq.c
@@ -57,6 +57,7 @@
 #include "glamo-core.h"
 #include "glamo-drm-private.h"
 #include "glamo-regs.h"
+#include "glamo-buffer.h"
 
 
 #define GLAMO_CMDQ_SIZE (128 * 1024)    /* 128k ring buffer */
@@ -495,10 +496,11 @@ int glamo_cmdq_setup(struct glamodrm_handle *gdrm)
 }
 
 
-int glamo_cmdq_init(struct glamodrm_handle *gdrm)
+int glamo_cmdq_init(struct drm_device *dev)
 {
 	struct drm_gem_object *obj;
 	struct drm_glamo_gem_object *gobj;
+	struct glamodrm_handle *gdrm = dev->dev_private;
 	int ret = 0;
 
 	obj = glamo_gem_object_alloc(dev, GLAMO_CMDQ_SIZE, 4);
@@ -507,9 +509,10 @@ int glamo_cmdq_init(struct glamodrm_handle *gdrm)
 		ret = -ENOMEM;
 		goto out;
 	}
-	gobj = fbo->driver_private;
+	gobj = obj->driver_private;
 	gdrm->cmdq_offs = GLAMO_OFFSET_FB + gobj->block->start;
-	gdrm->cmdq_base = ioremap(gdrm->vram->start + offs, GLAMO_CMDQ_SIZE);
+	gdrm->cmdq_base = ioremap(gdrm->vram->start + gdrm->cmdq_offs,
+	                          GLAMO_CMDQ_SIZE);
 
 	/* Set up registers */
 	glamo_cmdq_setup(gdrm);
@@ -521,6 +524,7 @@ out:
 
 int glamo_cmdq_shutdown(struct glamodrm_handle *gdrm)
 {
+	iounmap(gdrm->cmdq_base);
 	return 0;
 }
 
diff --git a/drivers/mfd/glamo/glamo-cmdq.h b/drivers/mfd/glamo/glamo-cmdq.h
index 510d195..6d7f184 100644
--- a/drivers/mfd/glamo/glamo-cmdq.h
+++ b/drivers/mfd/glamo/glamo-cmdq.h
@@ -38,7 +38,7 @@ extern int glamo_ioctl_cmdburst(struct drm_device *dev, void *data,
 extern void glamo_cmdq_blank(struct glamodrm_handle *gdrm,
                              struct drm_gem_object *obj);
 
-extern int glamo_cmdq_init(struct glamodrm_handle *gdrm);
+extern int glamo_cmdq_init(struct drm_device *de);
 extern int glamo_cmdq_shutdown(struct glamodrm_handle *gdrm);
 extern void glamo_cmdq_suspend(struct glamodrm_handle *gdrm);
 extern void glamo_cmdq_resume(struct glamodrm_handle *gdrm);
diff --git a/drivers/mfd/glamo/glamo-drm-drv.c b/drivers/mfd/glamo/glamo-drm-drv.c
index 774eaff..ee648c1 100644
--- a/drivers/mfd/glamo/glamo-drm-drv.c
+++ b/drivers/mfd/glamo/glamo-drm-drv.c
@@ -128,7 +128,7 @@ static int glamodrm_load(struct drm_device *dev, unsigned long flags)
 	gdrm = dev->dev_private;
 
 	glamo_buffer_init(gdrm);
-	glamo_cmdq_init(gdrm);
+	glamo_cmdq_init(dev);
 	glamo_fence_init(gdrm);
 	glamo_display_init(dev);
 
@@ -237,14 +237,14 @@ static int glamodrm_probe(struct platform_device *pdev)
 	if ( !gdrm->vram ) {
 		dev_err(&pdev->dev, "Unable to find VRAM.\n");
 		rc = -ENOENT;
-		goto out_unmap_cmdq;
+		goto out_unmap_regs;
 	}
 	gdrm->vram = request_mem_region(gdrm->vram->start,
 	                                resource_size(gdrm->vram), pdev->name);
 	if ( !gdrm->vram ) {
 		dev_err(&pdev->dev, "failed to request VRAM region\n");
 		rc = -ENOENT;
-		goto out_unmap_cmdq;
+		goto out_unmap_regs;
 	}
 
 	/* Find the LCD controller */
@@ -316,10 +316,6 @@ out_release_lcd:
 	                   resource_size(gdrm->lcd_regs));
 out_release_vram:
 	release_mem_region(gdrm->vram->start, resource_size(gdrm->vram));
-out_unmap_cmdq:
-	iounmap(gdrm->cmdq_base);
-out_release_cmdq:
-	release_mem_region(gdrm->cmdq->start, resource_size(gdrm->cmdq));
 out_unmap_regs:
 	iounmap(gdrm->reg_base);
 out_release_regs:
@@ -349,9 +345,10 @@ static int glamodrm_remove(struct platform_device *pdev)
 	/* Release VRAM */
 	release_mem_region(gdrm->vram->start, resource_size(gdrm->vram));
 
-	/* Release command queue */
-	iounmap(gdrm->cmdq_base);
-	release_mem_region(gdrm->cmdq->start, resource_size(gdrm->cmdq));
+	/* Release LCD registers */
+	iounmap(gdrm->lcd_base);
+	release_mem_region(gdrm->lcd_regs->start,
+	                   resource_size(gdrm->lcd_regs));
 
 	/* Release 2D engine  */
 	iounmap(gdrm->twod_base);
-- 
1.7.1