diff options
author | Alan Cox <alan@linux.jf.intel.com> | 2011-02-24 11:24:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-28 20:59:56 -0500 |
commit | aa19d8e9901ea9056e4e1e5c25af9b154d4e069b (patch) | |
tree | b4aa4164949341fae10b963fd912a8b4d160d847 /drivers/staging | |
parent | b75ae07963f99f89319b17935af20513d57df577 (diff) |
staging: gma500: Add 2D acceleration
This is taken from Richard Purdie's previous attempt to rip the heart out
of the PVR driver and stake it.
Accelerate copies and fills.
[Revised patch which disables the methods until we can finish debugging them]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/gma500/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_2d.c | 411 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_drv.c | 12 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_drv.h | 13 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_fb.c | 8 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_irq.c | 4 |
6 files changed, 444 insertions, 5 deletions
diff --git a/drivers/staging/gma500/Makefile b/drivers/staging/gma500/Makefile index 21381eb4031..a52ba48be51 100644 --- a/drivers/staging/gma500/Makefile +++ b/drivers/staging/gma500/Makefile | |||
@@ -6,6 +6,7 @@ ccflags-y += -Iinclude/drm | |||
6 | psb_gfx-y += psb_bl.o \ | 6 | psb_gfx-y += psb_bl.o \ |
7 | psb_drv.o \ | 7 | psb_drv.o \ |
8 | psb_fb.o \ | 8 | psb_fb.o \ |
9 | psb_2d.o \ | ||
9 | psb_gtt.o \ | 10 | psb_gtt.o \ |
10 | psb_intel_bios.o \ | 11 | psb_intel_bios.o \ |
11 | psb_intel_opregion.o \ | 12 | psb_intel_opregion.o \ |
diff --git a/drivers/staging/gma500/psb_2d.c b/drivers/staging/gma500/psb_2d.c new file mode 100644 index 00000000000..e4cae5d77d0 --- /dev/null +++ b/drivers/staging/gma500/psb_2d.c | |||
@@ -0,0 +1,411 @@ | |||
1 | /************************************************************************** | ||
2 | * Copyright (c) 2007, Intel Corporation. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | * Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to | ||
19 | * develop this driver. | ||
20 | * | ||
21 | **************************************************************************/ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/tty.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/fb.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/console.h> | ||
34 | |||
35 | #include <drm/drmP.h> | ||
36 | #include <drm/drm.h> | ||
37 | #include <drm/drm_crtc.h> | ||
38 | |||
39 | #include "psb_drv.h" | ||
40 | #include "psb_reg.h" | ||
41 | #include "psb_drv.h" | ||
42 | #include "psb_fb.h" | ||
43 | #include "psb_sgx.h" | ||
44 | |||
45 | void psb_spank(struct drm_psb_private *dev_priv) | ||
46 | { | ||
47 | PSB_WSGX32(_PSB_CS_RESET_BIF_RESET | _PSB_CS_RESET_DPM_RESET | | ||
48 | _PSB_CS_RESET_TA_RESET | _PSB_CS_RESET_USE_RESET | | ||
49 | _PSB_CS_RESET_ISP_RESET | _PSB_CS_RESET_TSP_RESET | | ||
50 | _PSB_CS_RESET_TWOD_RESET, PSB_CR_SOFT_RESET); | ||
51 | (void) PSB_RSGX32(PSB_CR_SOFT_RESET); | ||
52 | |||
53 | msleep(1); | ||
54 | |||
55 | PSB_WSGX32(0, PSB_CR_SOFT_RESET); | ||
56 | wmb(); | ||
57 | PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) | _PSB_CB_CTRL_CLEAR_FAULT, | ||
58 | PSB_CR_BIF_CTRL); | ||
59 | wmb(); | ||
60 | (void) PSB_RSGX32(PSB_CR_BIF_CTRL); | ||
61 | |||
62 | msleep(1); | ||
63 | PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) & ~_PSB_CB_CTRL_CLEAR_FAULT, | ||
64 | PSB_CR_BIF_CTRL); | ||
65 | (void) PSB_RSGX32(PSB_CR_BIF_CTRL); | ||
66 | PSB_WSGX32(dev_priv->pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); | ||
67 | } | ||
68 | |||
69 | static int psb_2d_wait_available(struct drm_psb_private *dev_priv, | ||
70 | unsigned size) | ||
71 | { | ||
72 | uint32_t avail = PSB_RSGX32(PSB_CR_2D_SOCIF); | ||
73 | unsigned long t = jiffies + HZ; | ||
74 | |||
75 | while(avail < size) { | ||
76 | avail = PSB_RSGX32(PSB_CR_2D_SOCIF); | ||
77 | if (time_after(jiffies, t)) { | ||
78 | psb_spank(dev_priv); | ||
79 | return -EIO; | ||
80 | } | ||
81 | } | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | /* FIXME: Remember if we expose the 2D engine to the DRM we need to serialize | ||
86 | it with console use */ | ||
87 | |||
88 | static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf, | ||
89 | unsigned size) | ||
90 | { | ||
91 | int ret = 0; | ||
92 | int i; | ||
93 | unsigned submit_size; | ||
94 | |||
95 | while (size > 0) { | ||
96 | submit_size = (size < 0x60) ? size : 0x60; | ||
97 | size -= submit_size; | ||
98 | ret = psb_2d_wait_available(dev_priv, submit_size); | ||
99 | if (ret) | ||
100 | return ret; | ||
101 | |||
102 | submit_size <<= 2; | ||
103 | for (i = 0; i < submit_size; i += 4) { | ||
104 | PSB_WSGX32(*cmdbuf++, PSB_SGX_2D_SLAVE_PORT + i); | ||
105 | } | ||
106 | (void)PSB_RSGX32(PSB_SGX_2D_SLAVE_PORT + i - 4); | ||
107 | } | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int psb_accel_2d_fillrect(struct drm_psb_private *dev_priv, | ||
112 | uint32_t dst_offset, uint32_t dst_stride, | ||
113 | uint32_t dst_format, uint16_t dst_x, | ||
114 | uint16_t dst_y, uint16_t size_x, | ||
115 | uint16_t size_y, uint32_t fill) | ||
116 | { | ||
117 | uint32_t buffer[10]; | ||
118 | uint32_t *buf; | ||
119 | |||
120 | buf = buffer; | ||
121 | |||
122 | *buf++ = PSB_2D_FENCE_BH; | ||
123 | |||
124 | *buf++ = | ||
125 | PSB_2D_DST_SURF_BH | dst_format | (dst_stride << | ||
126 | PSB_2D_DST_STRIDE_SHIFT); | ||
127 | *buf++ = dst_offset; | ||
128 | |||
129 | *buf++ = | ||
130 | PSB_2D_BLIT_BH | | ||
131 | PSB_2D_ROT_NONE | | ||
132 | PSB_2D_COPYORDER_TL2BR | | ||
133 | PSB_2D_DSTCK_DISABLE | | ||
134 | PSB_2D_SRCCK_DISABLE | PSB_2D_USE_FILL | PSB_2D_ROP3_PATCOPY; | ||
135 | |||
136 | *buf++ = fill << PSB_2D_FILLCOLOUR_SHIFT; | ||
137 | *buf++ = | ||
138 | (dst_x << PSB_2D_DST_XSTART_SHIFT) | (dst_y << | ||
139 | PSB_2D_DST_YSTART_SHIFT); | ||
140 | *buf++ = | ||
141 | (size_x << PSB_2D_DST_XSIZE_SHIFT) | (size_y << | ||
142 | PSB_2D_DST_YSIZE_SHIFT); | ||
143 | *buf++ = PSB_2D_FLUSH_BH; | ||
144 | |||
145 | return psbfb_2d_submit(dev_priv, buffer, buf - buffer); | ||
146 | } | ||
147 | |||
148 | static void psbfb_fillrect_accel(struct fb_info *info, | ||
149 | const struct fb_fillrect *r) | ||
150 | { | ||
151 | struct psb_fbdev *fbdev = info->par; | ||
152 | struct psb_framebuffer *psbfb = fbdev->pfb; | ||
153 | struct drm_device *dev = psbfb->base.dev; | ||
154 | struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; | ||
155 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
156 | |||
157 | uint32_t offset; | ||
158 | uint32_t stride; | ||
159 | uint32_t format; | ||
160 | |||
161 | if (!fb) | ||
162 | return; | ||
163 | |||
164 | offset = psbfb->offset; | ||
165 | stride = fb->pitch; | ||
166 | |||
167 | switch (fb->depth) { | ||
168 | case 8: | ||
169 | format = PSB_2D_DST_332RGB; | ||
170 | break; | ||
171 | case 15: | ||
172 | format = PSB_2D_DST_555RGB; | ||
173 | break; | ||
174 | case 16: | ||
175 | format = PSB_2D_DST_565RGB; | ||
176 | break; | ||
177 | case 24: | ||
178 | case 32: | ||
179 | /* this is wrong but since we don't do blending its okay */ | ||
180 | format = PSB_2D_DST_8888ARGB; | ||
181 | break; | ||
182 | default: | ||
183 | /* software fallback */ | ||
184 | cfb_fillrect(info, r); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | psb_accel_2d_fillrect(dev_priv, | ||
189 | offset, stride, format, | ||
190 | r->dx, r->dy, r->width, r->height, r->color); | ||
191 | } | ||
192 | |||
193 | void psbfb_fillrect(struct fb_info *info, | ||
194 | const struct fb_fillrect *rect) | ||
195 | { | ||
196 | if (unlikely(info->state != FBINFO_STATE_RUNNING)) | ||
197 | return; | ||
198 | |||
199 | if (1 || (info->flags & FBINFO_HWACCEL_DISABLED)) | ||
200 | return cfb_fillrect(info, rect); | ||
201 | |||
202 | /*psb_check_power_state(dev, PSB_DEVICE_SGX); */ | ||
203 | psbfb_fillrect_accel(info, rect); | ||
204 | /* Drop power again here on MRST FIXMEAC */ | ||
205 | } | ||
206 | |||
207 | static u32 psb_accel_2d_copy_direction(int xdir, int ydir) | ||
208 | { | ||
209 | if (xdir < 0) | ||
210 | return (ydir < 0) ? PSB_2D_COPYORDER_BR2TL : | ||
211 | PSB_2D_COPYORDER_TR2BL; | ||
212 | else | ||
213 | return (ydir < 0) ? PSB_2D_COPYORDER_BL2TR : | ||
214 | PSB_2D_COPYORDER_TL2BR; | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * @src_offset in bytes | ||
219 | * @src_stride in bytes | ||
220 | * @src_format psb 2D format defines | ||
221 | * @dst_offset in bytes | ||
222 | * @dst_stride in bytes | ||
223 | * @dst_format psb 2D format defines | ||
224 | * @src_x offset in pixels | ||
225 | * @src_y offset in pixels | ||
226 | * @dst_x offset in pixels | ||
227 | * @dst_y offset in pixels | ||
228 | * @size_x of the copied area | ||
229 | * @size_y of the copied area | ||
230 | */ | ||
231 | static int psb_accel_2d_copy(struct drm_psb_private *dev_priv, | ||
232 | uint32_t src_offset, uint32_t src_stride, | ||
233 | uint32_t src_format, uint32_t dst_offset, | ||
234 | uint32_t dst_stride, uint32_t dst_format, | ||
235 | uint16_t src_x, uint16_t src_y, | ||
236 | uint16_t dst_x, uint16_t dst_y, | ||
237 | uint16_t size_x, uint16_t size_y) | ||
238 | { | ||
239 | uint32_t blit_cmd; | ||
240 | uint32_t buffer[10]; | ||
241 | uint32_t *buf; | ||
242 | uint32_t direction; | ||
243 | |||
244 | buf = buffer; | ||
245 | |||
246 | direction = | ||
247 | psb_accel_2d_copy_direction(src_x - dst_x, src_y - dst_y); | ||
248 | |||
249 | if (direction == PSB_2D_COPYORDER_BR2TL || | ||
250 | direction == PSB_2D_COPYORDER_TR2BL) { | ||
251 | src_x += size_x - 1; | ||
252 | dst_x += size_x - 1; | ||
253 | } | ||
254 | if (direction == PSB_2D_COPYORDER_BR2TL || | ||
255 | direction == PSB_2D_COPYORDER_BL2TR) { | ||
256 | src_y += size_y - 1; | ||
257 | dst_y += size_y - 1; | ||
258 | } | ||
259 | |||
260 | blit_cmd = | ||
261 | PSB_2D_BLIT_BH | | ||
262 | PSB_2D_ROT_NONE | | ||
263 | PSB_2D_DSTCK_DISABLE | | ||
264 | PSB_2D_SRCCK_DISABLE | | ||
265 | PSB_2D_USE_PAT | PSB_2D_ROP3_SRCCOPY | direction; | ||
266 | |||
267 | *buf++ = PSB_2D_FENCE_BH; | ||
268 | *buf++ = | ||
269 | PSB_2D_DST_SURF_BH | dst_format | (dst_stride << | ||
270 | PSB_2D_DST_STRIDE_SHIFT); | ||
271 | *buf++ = dst_offset; | ||
272 | *buf++ = | ||
273 | PSB_2D_SRC_SURF_BH | src_format | (src_stride << | ||
274 | PSB_2D_SRC_STRIDE_SHIFT); | ||
275 | *buf++ = src_offset; | ||
276 | *buf++ = | ||
277 | PSB_2D_SRC_OFF_BH | (src_x << PSB_2D_SRCOFF_XSTART_SHIFT) | | ||
278 | (src_y << PSB_2D_SRCOFF_YSTART_SHIFT); | ||
279 | *buf++ = blit_cmd; | ||
280 | *buf++ = | ||
281 | (dst_x << PSB_2D_DST_XSTART_SHIFT) | (dst_y << | ||
282 | PSB_2D_DST_YSTART_SHIFT); | ||
283 | *buf++ = | ||
284 | (size_x << PSB_2D_DST_XSIZE_SHIFT) | (size_y << | ||
285 | PSB_2D_DST_YSIZE_SHIFT); | ||
286 | *buf++ = PSB_2D_FLUSH_BH; | ||
287 | |||
288 | return psbfb_2d_submit(dev_priv, buffer, buf - buffer); | ||
289 | } | ||
290 | |||
291 | static void psbfb_copyarea_accel(struct fb_info *info, | ||
292 | const struct fb_copyarea *a) | ||
293 | { | ||
294 | struct psb_fbdev *fbdev = info->par; | ||
295 | struct psb_framebuffer *psbfb = fbdev->pfb; | ||
296 | struct drm_device *dev = psbfb->base.dev; | ||
297 | struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; | ||
298 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
299 | uint32_t offset; | ||
300 | uint32_t stride; | ||
301 | uint32_t src_format; | ||
302 | uint32_t dst_format; | ||
303 | |||
304 | if (!fb) | ||
305 | return; | ||
306 | |||
307 | offset = psbfb->offset; | ||
308 | stride = fb->pitch; | ||
309 | |||
310 | switch (fb->depth) { | ||
311 | case 8: | ||
312 | src_format = PSB_2D_SRC_332RGB; | ||
313 | dst_format = PSB_2D_DST_332RGB; | ||
314 | break; | ||
315 | case 15: | ||
316 | src_format = PSB_2D_SRC_555RGB; | ||
317 | dst_format = PSB_2D_DST_555RGB; | ||
318 | break; | ||
319 | case 16: | ||
320 | src_format = PSB_2D_SRC_565RGB; | ||
321 | dst_format = PSB_2D_DST_565RGB; | ||
322 | break; | ||
323 | case 24: | ||
324 | case 32: | ||
325 | /* this is wrong but since we don't do blending its okay */ | ||
326 | src_format = PSB_2D_SRC_8888ARGB; | ||
327 | dst_format = PSB_2D_DST_8888ARGB; | ||
328 | break; | ||
329 | default: | ||
330 | /* software fallback */ | ||
331 | cfb_copyarea(info, a); | ||
332 | return; | ||
333 | } | ||
334 | |||
335 | psb_accel_2d_copy(dev_priv, | ||
336 | offset, stride, src_format, | ||
337 | offset, stride, dst_format, | ||
338 | a->sx, a->sy, a->dx, a->dy, a->width, a->height); | ||
339 | } | ||
340 | |||
341 | void psbfb_copyarea(struct fb_info *info, | ||
342 | const struct fb_copyarea *region) | ||
343 | { | ||
344 | if (unlikely(info->state != FBINFO_STATE_RUNNING)) | ||
345 | return; | ||
346 | |||
347 | if (1 || (info->flags & FBINFO_HWACCEL_DISABLED)) | ||
348 | return cfb_copyarea(info, region); | ||
349 | |||
350 | /* psb_check_power_state(dev, PSB_DEVICE_SGX); */ | ||
351 | psbfb_copyarea_accel(info, region); | ||
352 | /* Need to power back off here for MRST FIXMEAC */ | ||
353 | } | ||
354 | |||
355 | void psbfb_imageblit(struct fb_info *info, const struct fb_image *image) | ||
356 | { | ||
357 | /* For now */ | ||
358 | cfb_imageblit(info, image); | ||
359 | } | ||
360 | |||
361 | int psbfb_sync(struct fb_info *info) | ||
362 | { | ||
363 | struct psb_fbdev *fbdev = info->par; | ||
364 | struct psb_framebuffer *psbfb = fbdev->pfb; | ||
365 | struct drm_device *dev = psbfb->base.dev; | ||
366 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
367 | unsigned long _end = jiffies + DRM_HZ; | ||
368 | int busy = 0; | ||
369 | |||
370 | #if 0 | ||
371 | /* Just a way to quickly test if cmd issue explodes */ | ||
372 | u32 test[2] = { | ||
373 | PSB_2D_FENCE_BH, | ||
374 | }; | ||
375 | psbfb_2d_submit(dev_priv, test, 1); | ||
376 | #endif | ||
377 | /* | ||
378 | * First idle the 2D engine. | ||
379 | */ | ||
380 | |||
381 | if ((PSB_RSGX32(PSB_CR_2D_SOCIF) == _PSB_C2_SOCIF_EMPTY) && | ||
382 | ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & _PSB_C2B_STATUS_BUSY) == 0)) | ||
383 | goto out; | ||
384 | |||
385 | do { | ||
386 | busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); | ||
387 | cpu_relax(); | ||
388 | } while (busy && !time_after_eq(jiffies, _end)); | ||
389 | |||
390 | if (busy) | ||
391 | busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); | ||
392 | if (busy) | ||
393 | goto out; | ||
394 | |||
395 | do { | ||
396 | busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & | ||
397 | _PSB_C2B_STATUS_BUSY) != 0); | ||
398 | cpu_relax(); | ||
399 | } while (busy && !time_after_eq(jiffies, _end)); | ||
400 | if (busy) | ||
401 | busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & | ||
402 | _PSB_C2B_STATUS_BUSY) != 0); | ||
403 | |||
404 | out: | ||
405 | return (busy) ? -EBUSY : 0; | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | info->fix.accel = FB_ACCEL_I830; | ||
410 | info->flags = FBINFO_DEFAULT; | ||
411 | */ | ||
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c index 2fe09c828a9..2b410af91df 100644 --- a/drivers/staging/gma500/psb_drv.c +++ b/drivers/staging/gma500/psb_drv.c | |||
@@ -446,6 +446,7 @@ static int psb_do_init(struct drm_device *dev) | |||
446 | goto out_err; | 446 | goto out_err; |
447 | } | 447 | } |
448 | 448 | ||
449 | |||
449 | stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; | 450 | stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; |
450 | stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; | 451 | stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; |
451 | stolen_gtt = | 452 | stolen_gtt = |
@@ -471,6 +472,7 @@ static int psb_do_init(struct drm_device *dev) | |||
471 | _PSB_CC_REVISION_DESIGNER_SHIFT); | 472 | _PSB_CC_REVISION_DESIGNER_SHIFT); |
472 | } | 473 | } |
473 | 474 | ||
475 | |||
474 | spin_lock_init(&dev_priv->irqmask_lock); | 476 | spin_lock_init(&dev_priv->irqmask_lock); |
475 | 477 | ||
476 | tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ? | 478 | tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ? |
@@ -479,6 +481,14 @@ static int psb_do_init(struct drm_device *dev) | |||
479 | tt_pages -= tt_start >> PAGE_SHIFT; | 481 | tt_pages -= tt_start >> PAGE_SHIFT; |
480 | dev_priv->sizes.ta_mem_size = 0; | 482 | dev_priv->sizes.ta_mem_size = 0; |
481 | 483 | ||
484 | PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0); | ||
485 | PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1); | ||
486 | PSB_RSGX32(PSB_CR_BIF_BANK1); | ||
487 | PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) | _PSB_MMU_ER_MASK, | ||
488 | PSB_CR_BIF_CTRL); | ||
489 | psb_spank(dev_priv); | ||
490 | |||
491 | PSB_WSGX32(pg->mmu_gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); | ||
482 | 492 | ||
483 | /* TT region managed by TTM. */ | 493 | /* TT region managed by TTM. */ |
484 | if (!ttm_bo_init_mm(bdev, TTM_PL_TT, | 494 | if (!ttm_bo_init_mm(bdev, TTM_PL_TT, |
@@ -500,7 +510,6 @@ static int psb_do_init(struct drm_device *dev) | |||
500 | PSB_MEM_TT_START / (1024*1024); | 510 | PSB_MEM_TT_START / (1024*1024); |
501 | } | 511 | } |
502 | 512 | ||
503 | |||
504 | PSB_DEBUG_INIT("Init MSVDX\n"); | 513 | PSB_DEBUG_INIT("Init MSVDX\n"); |
505 | return 0; | 514 | return 0; |
506 | out_err: | 515 | out_err: |
@@ -786,6 +795,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) | |||
786 | dev_priv->pipestat[1] = 0; | 795 | dev_priv->pipestat[1] = 0; |
787 | dev_priv->pipestat[2] = 0; | 796 | dev_priv->pipestat[2] = 0; |
788 | spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); | 797 | spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); |
798 | PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM); | ||
789 | PSB_WVDC32(0x00000000, PSB_INT_ENABLE_R); | 799 | PSB_WVDC32(0x00000000, PSB_INT_ENABLE_R); |
790 | PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); | 800 | PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); |
791 | spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); | 801 | spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); |
diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h index 79417a4b51a..f7c976299ad 100644 --- a/drivers/staging/gma500/psb_drv.h +++ b/drivers/staging/gma500/psb_drv.h | |||
@@ -919,6 +919,19 @@ extern int psbfb_kms_on_ioctl(struct drm_device *dev, void *data, | |||
919 | extern void *psbfb_vdc_reg(struct drm_device* dev); | 919 | extern void *psbfb_vdc_reg(struct drm_device* dev); |
920 | 920 | ||
921 | /* | 921 | /* |
922 | * psb_2d.c | ||
923 | */ | ||
924 | extern void psbfb_fillrect(struct fb_info *info, | ||
925 | const struct fb_fillrect *rect); | ||
926 | extern void psbfb_copyarea(struct fb_info *info, | ||
927 | const struct fb_copyarea *region); | ||
928 | extern void psbfb_imageblit(struct fb_info *info, | ||
929 | const struct fb_image *image); | ||
930 | extern int psbfb_sync(struct fb_info *info); | ||
931 | |||
932 | extern void psb_spank(struct drm_psb_private *dev_priv); | ||
933 | |||
934 | /* | ||
922 | *psb_reset.c | 935 | *psb_reset.c |
923 | */ | 936 | */ |
924 | 937 | ||
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c index 6585e888224..94d84574031 100644 --- a/drivers/staging/gma500/psb_fb.c +++ b/drivers/staging/gma500/psb_fb.c | |||
@@ -279,10 +279,11 @@ static struct fb_ops psbfb_ops = { | |||
279 | .fb_set_par = drm_fb_helper_set_par, | 279 | .fb_set_par = drm_fb_helper_set_par, |
280 | .fb_blank = drm_fb_helper_blank, | 280 | .fb_blank = drm_fb_helper_blank, |
281 | .fb_setcolreg = psbfb_setcolreg, | 281 | .fb_setcolreg = psbfb_setcolreg, |
282 | .fb_fillrect = cfb_fillrect, | 282 | .fb_fillrect = psbfb_fillrect, |
283 | .fb_copyarea = cfb_copyarea, | 283 | .fb_copyarea = psbfb_copyarea, |
284 | .fb_imageblit = cfb_imageblit, | 284 | .fb_imageblit = psbfb_imageblit, |
285 | .fb_mmap = psbfb_mmap, | 285 | .fb_mmap = psbfb_mmap, |
286 | .fb_sync = psbfb_sync, | ||
286 | }; | 287 | }; |
287 | 288 | ||
288 | static struct drm_framebuffer *psb_framebuffer_create | 289 | static struct drm_framebuffer *psb_framebuffer_create |
@@ -394,6 +395,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create | |||
394 | strcpy(info->fix.id, "psbfb"); | 395 | strcpy(info->fix.id, "psbfb"); |
395 | 396 | ||
396 | info->flags = FBINFO_DEFAULT; | 397 | info->flags = FBINFO_DEFAULT; |
398 | info->fix.accel = FB_ACCEL_I830; /*FIXMEAC*/ | ||
397 | info->fbops = &psbfb_ops; | 399 | info->fbops = &psbfb_ops; |
398 | 400 | ||
399 | info->fix.smem_start = dev->mode_config.fb_base; | 401 | info->fix.smem_start = dev->mode_config.fb_base; |
diff --git a/drivers/staging/gma500/psb_irq.c b/drivers/staging/gma500/psb_irq.c index 3cdcd1e1255..ce7dbf4e555 100644 --- a/drivers/staging/gma500/psb_irq.c +++ b/drivers/staging/gma500/psb_irq.c | |||
@@ -256,6 +256,7 @@ irqreturn_t psb_irq_handler(DRM_IRQ_ARGS) | |||
256 | PSB_WSGX32(s2, PSB_CR_EVENT_HOST_CLEAR2); | 256 | PSB_WSGX32(s2, PSB_CR_EVENT_HOST_CLEAR2); |
257 | /* if s & _PSB_CE_TWOD_COMPLETE we have 2D done but | 257 | /* if s & _PSB_CE_TWOD_COMPLETE we have 2D done but |
258 | we may as well poll even if we add that ! */ | 258 | we may as well poll even if we add that ! */ |
259 | handled = 1; | ||
259 | } | 260 | } |
260 | 261 | ||
261 | PSB_WVDC32(vdc_stat, PSB_INT_IDENTITY_R); | 262 | PSB_WVDC32(vdc_stat, PSB_INT_IDENTITY_R); |
@@ -300,9 +301,10 @@ void psb_irq_preinstall_islands(struct drm_device *dev, int hw_islands) | |||
300 | _MDFLD_PIPEC_EVENT_FLAG; | 301 | _MDFLD_PIPEC_EVENT_FLAG; |
301 | } | 302 | } |
302 | } | 303 | } |
304 | /* NO I DONT WANT ANY IRQS GRRR FIXMEAC */ | ||
303 | if (hw_islands & OSPM_GRAPHICS_ISLAND) | 305 | if (hw_islands & OSPM_GRAPHICS_ISLAND) |
304 | dev_priv->vdc_irq_mask |= _PSB_IRQ_SGX_FLAG; | 306 | dev_priv->vdc_irq_mask |= _PSB_IRQ_SGX_FLAG; |
305 | 307 | /* */ | |
306 | /*This register is safe even if display island is off*/ | 308 | /*This register is safe even if display island is off*/ |
307 | PSB_WVDC32(~dev_priv->vdc_irq_mask, PSB_INT_MASK_R); | 309 | PSB_WVDC32(~dev_priv->vdc_irq_mask, PSB_INT_MASK_R); |
308 | 310 | ||