]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/video/ps3fb.c
ps3fb: make frame buffer offsets unsigned int
[linux-2.6-omap-h63xx.git] / drivers / video / ps3fb.c
1 /*
2  *  linux/drivers/video/ps3fb.c -- PS3 GPU frame buffer device
3  *
4  *      Copyright (C) 2006 Sony Computer Entertainment Inc.
5  *      Copyright 2006, 2007 Sony Corporation
6  *
7  *  This file is based on :
8  *
9  *  linux/drivers/video/vfb.c -- Virtual frame buffer device
10  *
11  *      Copyright (C) 2002 James Simmons
12  *
13  *      Copyright (C) 1997 Geert Uytterhoeven
14  *
15  *  This file is subject to the terms and conditions of the GNU General Public
16  *  License. See the file COPYING in the main directory of this archive for
17  *  more details.
18  */
19
20 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/errno.h>
23 #include <linux/string.h>
24 #include <linux/mm.h>
25 #include <linux/interrupt.h>
26 #include <linux/console.h>
27 #include <linux/ioctl.h>
28 #include <linux/kthread.h>
29 #include <linux/freezer.h>
30 #include <linux/uaccess.h>
31 #include <linux/fb.h>
32 #include <linux/init.h>
33
34 #include <asm/abs_addr.h>
35 #include <asm/lv1call.h>
36 #include <asm/ps3av.h>
37 #include <asm/ps3fb.h>
38 #include <asm/ps3.h>
39
40
41 #define DEVICE_NAME             "ps3fb"
42
43 #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC    0x101
44 #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP    0x102
45 #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP        0x600
46 #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT         0x601
47 #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC    0x602
48
49 #define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION       (1ULL << 32)
50
51 #define L1GPU_DISPLAY_SYNC_HSYNC                1
52 #define L1GPU_DISPLAY_SYNC_VSYNC                2
53
54 #define GPU_CMD_BUF_SIZE                        (2 * 1024 * 1024)
55 #define GPU_FB_START                            (64 * 1024)
56 #define GPU_IOIF                                (0x0d000000UL)
57 #define GPU_ALIGN_UP(x)                         _ALIGN_UP((x), 64)
58 #define GPU_MAX_LINE_LENGTH                     (65536 - 64)
59
60 #define GPU_INTR_STATUS_VSYNC_0                 0       /* vsync on head A */
61 #define GPU_INTR_STATUS_VSYNC_1                 1       /* vsync on head B */
62 #define GPU_INTR_STATUS_FLIP_0                  3       /* flip head A */
63 #define GPU_INTR_STATUS_FLIP_1                  4       /* flip head B */
64 #define GPU_INTR_STATUS_QUEUE_0                 5       /* queue head A */
65 #define GPU_INTR_STATUS_QUEUE_1                 6       /* queue head B */
66
67 #define GPU_DRIVER_INFO_VERSION                 0x211
68
69 /* gpu internals */
70 struct display_head {
71         u64 be_time_stamp;
72         u32 status;
73         u32 offset;
74         u32 res1;
75         u32 res2;
76         u32 field;
77         u32 reserved1;
78
79         u64 res3;
80         u32 raster;
81
82         u64 vblank_count;
83         u32 field_vsync;
84         u32 reserved2;
85 };
86
87 struct gpu_irq {
88         u32 irq_outlet;
89         u32 status;
90         u32 mask;
91         u32 video_cause;
92         u32 graph_cause;
93         u32 user_cause;
94
95         u32 res1;
96         u64 res2;
97
98         u32 reserved[4];
99 };
100
101 struct gpu_driver_info {
102         u32 version_driver;
103         u32 version_gpu;
104         u32 memory_size;
105         u32 hardware_channel;
106
107         u32 nvcore_frequency;
108         u32 memory_frequency;
109
110         u32 reserved[1063];
111         struct display_head display_head[8];
112         struct gpu_irq irq;
113 };
114
115 struct ps3fb_priv {
116         unsigned int irq_no;
117
118         u64 context_handle, memory_handle;
119         void *xdr_ea;
120         size_t xdr_size;
121         struct gpu_driver_info *dinfo;
122
123         u64 vblank_count;       /* frame count */
124         wait_queue_head_t wait_vsync;
125
126         atomic_t ext_flip;      /* on/off flip with vsync */
127         atomic_t f_count;       /* fb_open count */
128         int is_blanked;
129         int is_kicked;
130         struct task_struct *task;
131 };
132 static struct ps3fb_priv ps3fb;
133
134 struct ps3fb_par {
135         u32 pseudo_palette[16];
136         int mode_id, new_mode_id;
137         unsigned int num_frames;        /* num of frame buffers */
138         unsigned int width;
139         unsigned int height;
140         unsigned int ddr_line_length;
141         unsigned int ddr_frame_size;
142         unsigned int xdr_frame_size;
143         unsigned int full_offset;       /* start of fullscreen DDR fb */
144         unsigned int fb_offset;         /* start of actual DDR fb */
145         unsigned int pan_offset;
146 };
147
148
149 static const struct fb_videomode ps3fb_modedb[] = {
150     /* 60 Hz broadcast modes (modes "1" to "5") */
151     {
152         /* 480i */
153         "480i", 60, 576, 384, 74074, 130, 89, 78, 57, 63, 6,
154         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
155     },    {
156         /* 480p */
157         "480p", 60, 576, 384, 37037, 130, 89, 78, 57, 63, 6,
158         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
159     },    {
160         /* 720p */
161         "720p", 60, 1124, 644, 13481, 298, 148, 57, 44, 80, 5,
162         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
163     },    {
164         /* 1080i */
165         "1080i", 60, 1688, 964, 13481, 264, 160, 94, 62, 88, 5,
166         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
167     },    {
168         /* 1080p */
169         "1080p", 60, 1688, 964, 6741, 264, 160, 94, 62, 88, 5,
170         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
171     },
172
173     /* 50 Hz broadcast modes (modes "6" to "10") */
174     {
175         /* 576i */
176         "576i", 50, 576, 460, 74074, 142, 83, 97, 63, 63, 5,
177         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
178     },    {
179         /* 576p */
180         "576p", 50, 576, 460, 37037, 142, 83, 97, 63, 63, 5,
181         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
182     },    {
183         /* 720p */
184         "720p", 50, 1124, 644, 13468, 298, 478, 57, 44, 80, 5,
185         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
186     },    {
187         /* 1080 */
188         "1080i", 50, 1688, 964, 13468, 264, 600, 94, 62, 88, 5,
189         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
190     },    {
191         /* 1080p */
192         "1080p", 50, 1688, 964, 6734, 264, 600, 94, 62, 88, 5,
193         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
194     },
195
196     /* VESA modes (modes "11" to "13") */
197     {
198         /* WXGA */
199         "wxga", 60, 1280, 768, 12924, 160, 24, 29, 3, 136, 6,
200         0, FB_VMODE_NONINTERLACED,
201         FB_MODE_IS_VESA
202     }, {
203         /* SXGA */
204         "sxga", 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
205         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED,
206         FB_MODE_IS_VESA
207     }, {
208         /* WUXGA */
209         "wuxga", 60, 1920, 1200, 6494, 80, 48, 26, 3, 32, 6,
210         FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED,
211         FB_MODE_IS_VESA
212     },
213
214     /* 60 Hz broadcast modes (full resolution versions of modes "1" to "5") */
215     {
216         /* 480if */
217         "480if", 60, 720, 480, 74074, 58, 17, 30, 9, 63, 6,
218         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
219     }, {
220         /* 480pf */
221         "480pf", 60, 720, 480, 37037, 58, 17, 30, 9, 63, 6,
222         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
223     }, {
224         /* 720pf */
225         "720pf", 60, 1280, 720, 13481, 220, 70, 19, 6, 80, 5,
226         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
227     }, {
228         /* 1080if */
229         "1080if", 60, 1920, 1080, 13481, 148, 44, 36, 4, 88, 5,
230         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
231     }, {
232         /* 1080pf */
233         "1080pf", 60, 1920, 1080, 6741, 148, 44, 36, 4, 88, 5,
234         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
235     },
236
237     /* 50 Hz broadcast modes (full resolution versions of modes "6" to "10") */
238     {
239         /* 576if */
240         "576if", 50, 720, 576, 74074, 70, 11, 39, 5, 63, 5,
241         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
242     }, {
243         /* 576pf */
244         "576pf", 50, 720, 576, 37037, 70, 11, 39, 5, 63, 5,
245         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
246     }, {
247         /* 720pf */
248         "720pf", 50, 1280, 720, 13468, 220, 400, 19, 6, 80, 5,
249         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
250     }, {
251         /* 1080if */
252         "1080f", 50, 1920, 1080, 13468, 148, 484, 36, 4, 88, 5,
253         FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
254     }, {
255         /* 1080pf */
256         "1080pf", 50, 1920, 1080, 6734, 148, 484, 36, 4, 88, 5,
257         FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
258     }
259 };
260
261
262 #define HEAD_A
263 #define HEAD_B
264
265 #define BPP             4                       /* number of bytes per pixel */
266
267
268 static int ps3fb_mode;
269 module_param(ps3fb_mode, int, 0);
270
271 static char *mode_option __devinitdata;
272
273 static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var,
274                                     u32 *ddr_line_length, u32 *xdr_line_length)
275 {
276         unsigned int i, fi, mode;
277
278         for (i = 0; i < ARRAY_SIZE(ps3fb_modedb); i++)
279                 if (var->xres == ps3fb_modedb[i].xres &&
280                     var->yres == ps3fb_modedb[i].yres &&
281                     var->pixclock == ps3fb_modedb[i].pixclock &&
282                     var->hsync_len == ps3fb_modedb[i].hsync_len &&
283                     var->vsync_len == ps3fb_modedb[i].vsync_len &&
284                     var->left_margin == ps3fb_modedb[i].left_margin &&
285                     var->right_margin == ps3fb_modedb[i].right_margin &&
286                     var->upper_margin == ps3fb_modedb[i].upper_margin &&
287                     var->lower_margin == ps3fb_modedb[i].lower_margin &&
288                     var->sync == ps3fb_modedb[i].sync &&
289                     (var->vmode & FB_VMODE_MASK) == ps3fb_modedb[i].vmode)
290                         goto found;
291
292         pr_debug("ps3fb_find_mode: mode not found\n");
293         return 0;
294
295 found:
296         /* Cropped broadcast modes use the full line length */
297         fi = i < PS3AV_MODE_1080P50 ? i + PS3AV_MODE_WUXGA : i;
298         *ddr_line_length = ps3fb_modedb[fi].xres * BPP;
299
300         if (ps3_compare_firmware_version(1, 9, 0) >= 0) {
301                 *xdr_line_length = GPU_ALIGN_UP(max(var->xres,
302                                                     var->xres_virtual) * BPP);
303                 if (*xdr_line_length > GPU_MAX_LINE_LENGTH)
304                         *xdr_line_length = GPU_MAX_LINE_LENGTH;
305         } else
306                 *xdr_line_length = *ddr_line_length;
307
308         /* Full broadcast modes have the full mode bit set */
309         mode = i+1;
310         if (mode > PS3AV_MODE_WUXGA)
311                 mode = (mode - PS3AV_MODE_WUXGA) | PS3AV_MODE_FULL;
312
313         pr_debug("ps3fb_find_mode: mode %u\n", mode);
314
315         return mode;
316 }
317
318 static const struct fb_videomode *ps3fb_default_mode(int id)
319 {
320         u32 mode = id & PS3AV_MODE_MASK;
321         u32 flags;
322
323         if (mode < PS3AV_MODE_480I || mode > PS3AV_MODE_WUXGA)
324                 return NULL;
325
326         flags = id & ~PS3AV_MODE_MASK;
327
328         if (mode <= PS3AV_MODE_1080P50 && flags & PS3AV_MODE_FULL) {
329                 /* Full broadcast mode */
330                 return &ps3fb_modedb[mode + PS3AV_MODE_WUXGA - 1];
331         }
332
333         return &ps3fb_modedb[mode - 1];
334 }
335
336 static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
337                              u64 dst_offset, u64 src_offset, u32 width,
338                              u32 height, u32 dst_line_length,
339                              u32 src_line_length)
340 {
341         int status;
342         u64 line_length;
343
344         line_length = dst_line_length;
345         if (src_line_length != dst_line_length)
346                 line_length |= (u64)src_line_length << 32;
347
348         src_offset += GPU_FB_START;
349         status = lv1_gpu_context_attribute(ps3fb.context_handle,
350                                            L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
351                                            dst_offset, GPU_IOIF + src_offset,
352                                            L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
353                                            (width << 16) | height,
354                                            line_length);
355         if (status)
356                 dev_err(dev,
357                         "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
358                         __func__, status);
359 #ifdef HEAD_A
360         status = lv1_gpu_context_attribute(ps3fb.context_handle,
361                                            L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
362                                            0, frame_offset, 0, 0);
363         if (status)
364                 dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
365                         __func__, status);
366 #endif
367 #ifdef HEAD_B
368         status = lv1_gpu_context_attribute(ps3fb.context_handle,
369                                            L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
370                                            1, frame_offset, 0, 0);
371         if (status)
372                 dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
373                         __func__, status);
374 #endif
375 }
376
377 static int ps3fb_sync(struct fb_info *info, u32 frame)
378 {
379         struct ps3fb_par *par = info->par;
380         int error = 0;
381         u64 ddr_base, xdr_base;
382
383         if (frame > par->num_frames - 1) {
384                 dev_dbg(info->device, "%s: invalid frame number (%u)\n",
385                         __func__, frame);
386                 error = -EINVAL;
387                 goto out;
388         }
389
390         xdr_base = frame * par->xdr_frame_size;
391         ddr_base = frame * par->ddr_frame_size;
392
393         ps3fb_sync_image(info->device, ddr_base + par->full_offset,
394                          ddr_base + par->fb_offset, xdr_base + par->pan_offset,
395                          par->width, par->height, par->ddr_line_length,
396                          info->fix.line_length);
397
398 out:
399         return error;
400 }
401
402 static int ps3fb_open(struct fb_info *info, int user)
403 {
404         atomic_inc(&ps3fb.f_count);
405         return 0;
406 }
407
408 static int ps3fb_release(struct fb_info *info, int user)
409 {
410         if (atomic_dec_and_test(&ps3fb.f_count)) {
411                 if (atomic_read(&ps3fb.ext_flip)) {
412                         atomic_set(&ps3fb.ext_flip, 0);
413                         if (!try_acquire_console_sem()) {
414                                 ps3fb_sync(info, 0);    /* single buffer */
415                                 release_console_sem();
416                         }
417                 }
418         }
419         return 0;
420 }
421
422     /*
423      *  Setting the video mode has been split into two parts.
424      *  First part, xxxfb_check_var, must not write anything
425      *  to hardware, it should only verify and adjust var.
426      *  This means it doesn't alter par but it does use hardware
427      *  data from it to check this var.
428      */
429
430 static int ps3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
431 {
432         u32 xdr_line_length, ddr_line_length;
433         int mode;
434
435         dev_dbg(info->device, "var->xres:%u info->var.xres:%u\n", var->xres,
436                 info->var.xres);
437         dev_dbg(info->device, "var->yres:%u info->var.yres:%u\n", var->yres,
438                 info->var.yres);
439
440         /* FIXME For now we do exact matches only */
441         mode = ps3fb_find_mode(var, &ddr_line_length, &xdr_line_length);
442         if (!mode)
443                 return -EINVAL;
444
445         /* Virtual screen */
446         if (var->xres_virtual < var->xres)
447                 var->xres_virtual = var->xres;
448         if (var->yres_virtual < var->yres)
449                 var->yres_virtual = var->yres;
450
451         if (var->xres_virtual > xdr_line_length / BPP) {
452                 dev_dbg(info->device,
453                         "Horizontal virtual screen size too large\n");
454                 return -EINVAL;
455         }
456
457         if (var->xoffset + var->xres > var->xres_virtual ||
458             var->yoffset + var->yres > var->yres_virtual) {
459                 dev_dbg(info->device, "panning out-of-range\n");
460                 return -EINVAL;
461         }
462
463         /* We support ARGB8888 only */
464         if (var->bits_per_pixel > 32 || var->grayscale ||
465             var->red.offset > 16 || var->green.offset > 8 ||
466             var->blue.offset > 0 || var->transp.offset > 24 ||
467             var->red.length > 8 || var->green.length > 8 ||
468             var->blue.length > 8 || var->transp.length > 8 ||
469             var->red.msb_right || var->green.msb_right ||
470             var->blue.msb_right || var->transp.msb_right || var->nonstd) {
471                 dev_dbg(info->device, "We support ARGB8888 only\n");
472                 return -EINVAL;
473         }
474
475         var->bits_per_pixel = 32;
476         var->red.offset = 16;
477         var->green.offset = 8;
478         var->blue.offset = 0;
479         var->transp.offset = 24;
480         var->red.length = 8;
481         var->green.length = 8;
482         var->blue.length = 8;
483         var->transp.length = 8;
484         var->red.msb_right = 0;
485         var->green.msb_right = 0;
486         var->blue.msb_right = 0;
487         var->transp.msb_right = 0;
488
489         /* Rotation is not supported */
490         if (var->rotate) {
491                 dev_dbg(info->device, "Rotation is not supported\n");
492                 return -EINVAL;
493         }
494
495         /* Memory limit */
496         if (var->yres_virtual * xdr_line_length > ps3fb.xdr_size) {
497                 dev_dbg(info->device, "Not enough memory\n");
498                 return -ENOMEM;
499         }
500
501         var->height = -1;
502         var->width = -1;
503
504         return 0;
505 }
506
507     /*
508      * This routine actually sets the video mode.
509      */
510
511 static int ps3fb_set_par(struct fb_info *info)
512 {
513         struct ps3fb_par *par = info->par;
514         unsigned int mode, ddr_line_length, xdr_line_length, lines, maxlines;
515         unsigned int ddr_xoff, ddr_yoff, offset;
516         const struct fb_videomode *vmode;
517         u64 dst;
518
519         dev_dbg(info->device, "xres:%d xv:%d yres:%d yv:%d clock:%d\n",
520                 info->var.xres, info->var.xres_virtual,
521                 info->var.yres, info->var.yres_virtual, info->var.pixclock);
522
523         mode = ps3fb_find_mode(&info->var, &ddr_line_length, &xdr_line_length);
524         if (!mode)
525                 return -EINVAL;
526
527         vmode = ps3fb_default_mode(mode | PS3AV_MODE_FULL);
528
529         info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea);
530         info->fix.smem_len = ps3fb.xdr_size;
531         info->fix.xpanstep = info->var.xres_virtual > info->var.xres ? 1 : 0;
532         info->fix.ypanstep = info->var.yres_virtual > info->var.yres ? 1 : 0;
533         info->fix.line_length = xdr_line_length;
534
535         info->screen_base = (char __iomem *)ps3fb.xdr_ea;
536
537         par->ddr_line_length = ddr_line_length;
538         par->ddr_frame_size = vmode->yres * ddr_line_length;
539         par->xdr_frame_size = info->var.yres_virtual * xdr_line_length;
540
541         par->num_frames = ps3fb.xdr_size /
542                           max(par->ddr_frame_size, par->xdr_frame_size);
543
544         /* Keep the special bits we cannot set using fb_var_screeninfo */
545         par->new_mode_id = (par->new_mode_id & ~PS3AV_MODE_MASK) | mode;
546
547         par->width = info->var.xres;
548         par->height = info->var.yres;
549
550         /* Start of the virtual frame buffer (relative to fullscreen) */
551         ddr_xoff = info->var.left_margin - vmode->left_margin;
552         ddr_yoff = info->var.upper_margin - vmode->upper_margin;
553         offset = ddr_yoff * ddr_line_length + ddr_xoff * BPP;
554
555         par->fb_offset = GPU_ALIGN_UP(offset);
556         par->full_offset = par->fb_offset - offset;
557         par->pan_offset = info->var.yoffset * xdr_line_length +
558                           info->var.xoffset * BPP;
559
560         if (par->new_mode_id != par->mode_id) {
561                 if (ps3av_set_video_mode(par->new_mode_id)) {
562                         par->new_mode_id = par->mode_id;
563                         return -EINVAL;
564                 }
565                 par->mode_id = par->new_mode_id;
566         }
567
568         /* Clear XDR frame buffer memory */
569         memset(ps3fb.xdr_ea, 0, ps3fb.xdr_size);
570
571         /* Clear DDR frame buffer memory */
572         lines = vmode->yres * par->num_frames;
573         if (par->full_offset)
574                 lines++;
575         maxlines = ps3fb.xdr_size / ddr_line_length;
576         for (dst = 0; lines; dst += maxlines * ddr_line_length) {
577                 unsigned int l = min(lines, maxlines);
578                 ps3fb_sync_image(info->device, 0, dst, 0, vmode->xres, l,
579                                  ddr_line_length, ddr_line_length);
580                 lines -= l;
581         }
582
583         return 0;
584 }
585
586     /*
587      *  Set a single color register. The values supplied are already
588      *  rounded down to the hardware's capabilities (according to the
589      *  entries in the var structure). Return != 0 for invalid regno.
590      */
591
592 static int ps3fb_setcolreg(unsigned int regno, unsigned int red,
593                            unsigned int green, unsigned int blue,
594                            unsigned int transp, struct fb_info *info)
595 {
596         if (regno >= 16)
597                 return 1;
598
599         red >>= 8;
600         green >>= 8;
601         blue >>= 8;
602         transp >>= 8;
603
604         ((u32 *)info->pseudo_palette)[regno] = transp << 24 | red << 16 |
605                                                green << 8 | blue;
606         return 0;
607 }
608
609 static int ps3fb_pan_display(struct fb_var_screeninfo *var,
610                              struct fb_info *info)
611 {
612         struct ps3fb_par *par = info->par;
613
614         par->pan_offset = var->yoffset * info->fix.line_length +
615                           var->xoffset * BPP;
616         return 0;
617 }
618
619     /*
620      *  As we have a virtual frame buffer, we need our own mmap function
621      */
622
623 static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
624 {
625         unsigned long size, offset;
626
627         size = vma->vm_end - vma->vm_start;
628         offset = vma->vm_pgoff << PAGE_SHIFT;
629         if (offset + size > info->fix.smem_len)
630                 return -EINVAL;
631
632         offset += info->fix.smem_start;
633         if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
634                             size, vma->vm_page_prot))
635                 return -EAGAIN;
636
637         dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n",
638                 offset, vma->vm_start);
639         return 0;
640 }
641
642     /*
643      * Blank the display
644      */
645
646 static int ps3fb_blank(int blank, struct fb_info *info)
647 {
648         int retval;
649
650         dev_dbg(info->device, "%s: blank:%d\n", __func__, blank);
651         switch (blank) {
652         case FB_BLANK_POWERDOWN:
653         case FB_BLANK_HSYNC_SUSPEND:
654         case FB_BLANK_VSYNC_SUSPEND:
655         case FB_BLANK_NORMAL:
656                 retval = ps3av_video_mute(1);   /* mute on */
657                 if (!retval)
658                         ps3fb.is_blanked = 1;
659                 break;
660
661         default:                /* unblank */
662                 retval = ps3av_video_mute(0);   /* mute off */
663                 if (!retval)
664                         ps3fb.is_blanked = 0;
665                 break;
666         }
667         return retval;
668 }
669
670 static int ps3fb_get_vblank(struct fb_vblank *vblank)
671 {
672         memset(vblank, 0, sizeof(*vblank));
673         vblank->flags = FB_VBLANK_HAVE_VSYNC;
674         return 0;
675 }
676
677 static int ps3fb_wait_for_vsync(u32 crtc)
678 {
679         int ret;
680         u64 count;
681
682         count = ps3fb.vblank_count;
683         ret = wait_event_interruptible_timeout(ps3fb.wait_vsync,
684                                                count != ps3fb.vblank_count,
685                                                HZ / 10);
686         if (!ret)
687                 return -ETIMEDOUT;
688
689         return 0;
690 }
691
692 static void ps3fb_flip_ctl(int on, void *data)
693 {
694         struct ps3fb_priv *priv = data;
695         if (on)
696                 atomic_dec_if_positive(&priv->ext_flip);
697         else
698                 atomic_inc(&priv->ext_flip);
699 }
700
701
702     /*
703      * ioctl
704      */
705
706 static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
707                        unsigned long arg)
708 {
709         void __user *argp = (void __user *)arg;
710         u32 val;
711         int retval = -EFAULT;
712
713         switch (cmd) {
714         case FBIOGET_VBLANK:
715                 {
716                         struct fb_vblank vblank;
717                         dev_dbg(info->device, "FBIOGET_VBLANK:\n");
718                         retval = ps3fb_get_vblank(&vblank);
719                         if (retval)
720                                 break;
721
722                         if (copy_to_user(argp, &vblank, sizeof(vblank)))
723                                 retval = -EFAULT;
724                         break;
725                 }
726
727         case FBIO_WAITFORVSYNC:
728                 {
729                         u32 crt;
730                         dev_dbg(info->device, "FBIO_WAITFORVSYNC:\n");
731                         if (get_user(crt, (u32 __user *) arg))
732                                 break;
733
734                         retval = ps3fb_wait_for_vsync(crt);
735                         break;
736                 }
737
738         case PS3FB_IOCTL_SETMODE:
739                 {
740                         struct ps3fb_par *par = info->par;
741                         const struct fb_videomode *mode;
742                         struct fb_var_screeninfo var;
743
744                         if (copy_from_user(&val, argp, sizeof(val)))
745                                 break;
746
747                         if (!(val & PS3AV_MODE_MASK)) {
748                                 u32 id = ps3av_get_auto_mode();
749                                 if (id > 0)
750                                         val = (val & ~PS3AV_MODE_MASK) | id;
751                         }
752                         dev_dbg(info->device, "PS3FB_IOCTL_SETMODE:%x\n", val);
753                         retval = -EINVAL;
754                         mode = ps3fb_default_mode(val);
755                         if (mode) {
756                                 var = info->var;
757                                 fb_videomode_to_var(&var, mode);
758                                 acquire_console_sem();
759                                 info->flags |= FBINFO_MISC_USEREVENT;
760                                 /* Force, in case only special bits changed */
761                                 var.activate |= FB_ACTIVATE_FORCE;
762                                 par->new_mode_id = val;
763                                 retval = fb_set_var(info, &var);
764                                 info->flags &= ~FBINFO_MISC_USEREVENT;
765                                 release_console_sem();
766                         }
767                         break;
768                 }
769
770         case PS3FB_IOCTL_GETMODE:
771                 val = ps3av_get_mode();
772                 dev_dbg(info->device, "PS3FB_IOCTL_GETMODE:%x\n", val);
773                 if (!copy_to_user(argp, &val, sizeof(val)))
774                         retval = 0;
775                 break;
776
777         case PS3FB_IOCTL_SCREENINFO:
778                 {
779                         struct ps3fb_par *par = info->par;
780                         struct ps3fb_ioctl_res res;
781                         dev_dbg(info->device, "PS3FB_IOCTL_SCREENINFO:\n");
782                         res.xres = info->fix.line_length / BPP;
783                         res.yres = info->var.yres_virtual;
784                         res.xoff = (res.xres - info->var.xres) / 2;
785                         res.yoff = (res.yres - info->var.yres) / 2;
786                         res.num_frames = par->num_frames;
787                         if (!copy_to_user(argp, &res, sizeof(res)))
788                                 retval = 0;
789                         break;
790                 }
791
792         case PS3FB_IOCTL_ON:
793                 dev_dbg(info->device, "PS3FB_IOCTL_ON:\n");
794                 atomic_inc(&ps3fb.ext_flip);
795                 retval = 0;
796                 break;
797
798         case PS3FB_IOCTL_OFF:
799                 dev_dbg(info->device, "PS3FB_IOCTL_OFF:\n");
800                 atomic_dec_if_positive(&ps3fb.ext_flip);
801                 retval = 0;
802                 break;
803
804         case PS3FB_IOCTL_FSEL:
805                 if (copy_from_user(&val, argp, sizeof(val)))
806                         break;
807
808                 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
809                 acquire_console_sem();
810                 retval = ps3fb_sync(info, val);
811                 release_console_sem();
812                 break;
813
814         default:
815                 retval = -ENOIOCTLCMD;
816                 break;
817         }
818         return retval;
819 }
820
821 static int ps3fbd(void *arg)
822 {
823         struct fb_info *info = arg;
824
825         set_freezable();
826         while (!kthread_should_stop()) {
827                 try_to_freeze();
828                 set_current_state(TASK_INTERRUPTIBLE);
829                 if (ps3fb.is_kicked) {
830                         ps3fb.is_kicked = 0;
831                         acquire_console_sem();
832                         ps3fb_sync(info, 0);    /* single buffer */
833                         release_console_sem();
834                 }
835                 schedule();
836         }
837         return 0;
838 }
839
840 static irqreturn_t ps3fb_vsync_interrupt(int irq, void *ptr)
841 {
842         struct device *dev = ptr;
843         u64 v1;
844         int status;
845         struct display_head *head = &ps3fb.dinfo->display_head[1];
846
847         status = lv1_gpu_context_intr(ps3fb.context_handle, &v1);
848         if (status) {
849                 dev_err(dev, "%s: lv1_gpu_context_intr failed: %d\n", __func__,
850                         status);
851                 return IRQ_NONE;
852         }
853
854         if (v1 & (1 << GPU_INTR_STATUS_VSYNC_1)) {
855                 /* VSYNC */
856                 ps3fb.vblank_count = head->vblank_count;
857                 if (ps3fb.task && !ps3fb.is_blanked &&
858                     !atomic_read(&ps3fb.ext_flip)) {
859                         ps3fb.is_kicked = 1;
860                         wake_up_process(ps3fb.task);
861                 }
862                 wake_up_interruptible(&ps3fb.wait_vsync);
863         }
864
865         return IRQ_HANDLED;
866 }
867
868
869 static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo,
870                                 struct device *dev)
871 {
872         int error;
873
874         dev_dbg(dev, "version_driver:%x\n", dinfo->version_driver);
875         dev_dbg(dev, "irq outlet:%x\n", dinfo->irq.irq_outlet);
876         dev_dbg(dev,
877                 "version_gpu: %x memory_size: %x ch: %x core_freq: %d "
878                 "mem_freq:%d\n",
879                 dinfo->version_gpu, dinfo->memory_size, dinfo->hardware_channel,
880                 dinfo->nvcore_frequency/1000000, dinfo->memory_frequency/1000000);
881
882         if (dinfo->version_driver != GPU_DRIVER_INFO_VERSION) {
883                 dev_err(dev, "%s: version_driver err:%x\n", __func__,
884                         dinfo->version_driver);
885                 return -EINVAL;
886         }
887
888         error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet,
889                                    &ps3fb.irq_no);
890         if (error) {
891                 dev_err(dev, "%s: ps3_alloc_irq failed %d\n", __func__, error);
892                 return error;
893         }
894
895         error = request_irq(ps3fb.irq_no, ps3fb_vsync_interrupt, IRQF_DISABLED,
896                             DEVICE_NAME, dev);
897         if (error) {
898                 dev_err(dev, "%s: request_irq failed %d\n", __func__, error);
899                 ps3_irq_plug_destroy(ps3fb.irq_no);
900                 return error;
901         }
902
903         dinfo->irq.mask = (1 << GPU_INTR_STATUS_VSYNC_1) |
904                           (1 << GPU_INTR_STATUS_FLIP_1);
905         return 0;
906 }
907
908 static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
909 {
910         int status;
911
912         status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF,
913                                        xdr_lpar, ps3fb_videomemory.size, 0);
914         if (status) {
915                 dev_err(dev, "%s: lv1_gpu_context_iomap failed: %d\n",
916                         __func__, status);
917                 return -ENXIO;
918         }
919         dev_dbg(dev,
920                 "video:%p xdr_ea:%p ioif:%lx lpar:%lx phys:%lx size:%lx\n",
921                 ps3fb_videomemory.address, ps3fb.xdr_ea, GPU_IOIF, xdr_lpar,
922                 virt_to_abs(ps3fb.xdr_ea), ps3fb_videomemory.size);
923
924         status = lv1_gpu_context_attribute(ps3fb.context_handle,
925                                            L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
926                                            xdr_lpar, GPU_CMD_BUF_SIZE,
927                                            GPU_IOIF, 0);
928         if (status) {
929                 dev_err(dev,
930                         "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
931                         __func__, status);
932                 return -ENXIO;
933         }
934         return 0;
935 }
936
937 static struct fb_ops ps3fb_ops = {
938         .fb_open        = ps3fb_open,
939         .fb_release     = ps3fb_release,
940         .fb_read        = fb_sys_read,
941         .fb_write       = fb_sys_write,
942         .fb_check_var   = ps3fb_check_var,
943         .fb_set_par     = ps3fb_set_par,
944         .fb_setcolreg   = ps3fb_setcolreg,
945         .fb_pan_display = ps3fb_pan_display,
946         .fb_fillrect    = sys_fillrect,
947         .fb_copyarea    = sys_copyarea,
948         .fb_imageblit   = sys_imageblit,
949         .fb_mmap        = ps3fb_mmap,
950         .fb_blank       = ps3fb_blank,
951         .fb_ioctl       = ps3fb_ioctl,
952         .fb_compat_ioctl = ps3fb_ioctl
953 };
954
955 static struct fb_fix_screeninfo ps3fb_fix __initdata = {
956         .id =           DEVICE_NAME,
957         .type =         FB_TYPE_PACKED_PIXELS,
958         .visual =       FB_VISUAL_TRUECOLOR,
959         .accel =        FB_ACCEL_NONE,
960 };
961
962 static int ps3fb_set_sync(struct device *dev)
963 {
964         int status;
965
966 #ifdef HEAD_A
967         status = lv1_gpu_context_attribute(0x0,
968                                            L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
969                                            0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0);
970         if (status) {
971                 dev_err(dev,
972                         "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: "
973                         "%d\n",
974                         __func__, status);
975                 return -1;
976         }
977 #endif
978 #ifdef HEAD_B
979         status = lv1_gpu_context_attribute(0x0,
980                                            L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
981                                            1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0);
982
983         if (status) {
984                 dev_err(dev,
985                         "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: "
986                         "%d\n",
987                         __func__, status);
988                 return -1;
989         }
990 #endif
991         return 0;
992 }
993
994 static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
995 {
996         struct fb_info *info;
997         struct ps3fb_par *par;
998         int retval = -ENOMEM;
999         u64 ddr_lpar = 0;
1000         u64 lpar_dma_control = 0;
1001         u64 lpar_driver_info = 0;
1002         u64 lpar_reports = 0;
1003         u64 lpar_reports_size = 0;
1004         u64 xdr_lpar;
1005         int status;
1006         struct task_struct *task;
1007         unsigned long max_ps3fb_size;
1008
1009         if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
1010                 dev_err(&dev->core, "%s: Not enough video memory\n", __func__);
1011                 return -ENOMEM;
1012         }
1013
1014         status = ps3_open_hv_device(dev);
1015         if (status) {
1016                 dev_err(&dev->core, "%s: ps3_open_hv_device failed\n",
1017                         __func__);
1018                 goto err;
1019         }
1020
1021         if (!ps3fb_mode)
1022                 ps3fb_mode = ps3av_get_mode();
1023         dev_dbg(&dev->core, "ps3fb_mode: %d\n", ps3fb_mode);
1024
1025         atomic_set(&ps3fb.f_count, -1); /* fbcon opens ps3fb */
1026         atomic_set(&ps3fb.ext_flip, 0); /* for flip with vsync */
1027         init_waitqueue_head(&ps3fb.wait_vsync);
1028
1029         ps3fb_set_sync(&dev->core);
1030
1031         max_ps3fb_size = _ALIGN_UP(GPU_IOIF, 256*1024*1024) - GPU_IOIF;
1032         if (ps3fb_videomemory.size > max_ps3fb_size) {
1033                 dev_info(&dev->core, "Limiting ps3fb mem size to %lu bytes\n",
1034                          max_ps3fb_size);
1035                 ps3fb_videomemory.size = max_ps3fb_size;
1036         }
1037
1038         /* get gpu context handle */
1039         status = lv1_gpu_memory_allocate(ps3fb_videomemory.size, 0, 0, 0, 0,
1040                                          &ps3fb.memory_handle, &ddr_lpar);
1041         if (status) {
1042                 dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n",
1043                         __func__, status);
1044                 goto err;
1045         }
1046         dev_dbg(&dev->core, "ddr:lpar:0x%lx\n", ddr_lpar);
1047
1048         status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0,
1049                                           &ps3fb.context_handle,
1050                                           &lpar_dma_control, &lpar_driver_info,
1051                                           &lpar_reports, &lpar_reports_size);
1052         if (status) {
1053                 dev_err(&dev->core,
1054                         "%s: lv1_gpu_context_attribute failed: %d\n", __func__,
1055                         status);
1056                 goto err_gpu_memory_free;
1057         }
1058
1059         /* vsync interrupt */
1060         ps3fb.dinfo = ioremap(lpar_driver_info, 128 * 1024);
1061         if (!ps3fb.dinfo) {
1062                 dev_err(&dev->core, "%s: ioremap failed\n", __func__);
1063                 goto err_gpu_context_free;
1064         }
1065
1066         retval = ps3fb_vsync_settings(ps3fb.dinfo, &dev->core);
1067         if (retval)
1068                 goto err_iounmap_dinfo;
1069
1070         /* XDR frame buffer */
1071         ps3fb.xdr_ea = ps3fb_videomemory.address;
1072         xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb.xdr_ea));
1073
1074         /* Clear memory to prevent kernel info leakage into userspace */
1075         memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);
1076
1077         /*
1078          * The GPU command buffer is at the start of video memory
1079          * As we don't use the full command buffer, we can put the actual
1080          * frame buffer at offset GPU_FB_START and save some precious XDR
1081          * memory
1082          */
1083         ps3fb.xdr_ea += GPU_FB_START;
1084         ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;
1085
1086         retval = ps3fb_xdr_settings(xdr_lpar, &dev->core);
1087         if (retval)
1088                 goto err_free_irq;
1089
1090         info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core);
1091         if (!info)
1092                 goto err_free_irq;
1093
1094         par = info->par;
1095         par->mode_id = ~ps3fb_mode;     /* != ps3fb_mode, to trigger change */
1096         par->new_mode_id = ps3fb_mode;
1097         par->num_frames = 1;
1098
1099         info->screen_base = (char __iomem *)ps3fb.xdr_ea;
1100         info->fbops = &ps3fb_ops;
1101
1102         info->fix = ps3fb_fix;
1103         info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea);
1104         info->fix.smem_len = ps3fb.xdr_size;
1105         info->pseudo_palette = par->pseudo_palette;
1106         info->flags = FBINFO_DEFAULT | FBINFO_READS_FAST |
1107                       FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
1108
1109         retval = fb_alloc_cmap(&info->cmap, 256, 0);
1110         if (retval < 0)
1111                 goto err_framebuffer_release;
1112
1113         if (!fb_find_mode(&info->var, info, mode_option, ps3fb_modedb,
1114                           ARRAY_SIZE(ps3fb_modedb),
1115                           ps3fb_default_mode(par->new_mode_id), 32)) {
1116                 retval = -EINVAL;
1117                 goto err_fb_dealloc;
1118         }
1119
1120         fb_videomode_to_modelist(ps3fb_modedb, ARRAY_SIZE(ps3fb_modedb),
1121                                  &info->modelist);
1122
1123         retval = register_framebuffer(info);
1124         if (retval < 0)
1125                 goto err_fb_dealloc;
1126
1127         dev->core.driver_data = info;
1128
1129         dev_info(info->device, "%s %s, using %lu KiB of video memory\n",
1130                  dev_driver_string(info->dev), info->dev->bus_id,
1131                  ps3fb.xdr_size >> 10);
1132
1133         task = kthread_run(ps3fbd, info, DEVICE_NAME);
1134         if (IS_ERR(task)) {
1135                 retval = PTR_ERR(task);
1136                 goto err_unregister_framebuffer;
1137         }
1138
1139         ps3fb.task = task;
1140         ps3av_register_flip_ctl(ps3fb_flip_ctl, &ps3fb);
1141
1142         return 0;
1143
1144 err_unregister_framebuffer:
1145         unregister_framebuffer(info);
1146 err_fb_dealloc:
1147         fb_dealloc_cmap(&info->cmap);
1148 err_framebuffer_release:
1149         framebuffer_release(info);
1150 err_free_irq:
1151         free_irq(ps3fb.irq_no, &dev->core);
1152         ps3_irq_plug_destroy(ps3fb.irq_no);
1153 err_iounmap_dinfo:
1154         iounmap((u8 __iomem *)ps3fb.dinfo);
1155 err_gpu_context_free:
1156         lv1_gpu_context_free(ps3fb.context_handle);
1157 err_gpu_memory_free:
1158         lv1_gpu_memory_free(ps3fb.memory_handle);
1159 err:
1160         return retval;
1161 }
1162
1163 static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1164 {
1165         int status;
1166         struct fb_info *info = dev->core.driver_data;
1167
1168         dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
1169
1170         ps3fb_flip_ctl(0, &ps3fb);      /* flip off */
1171         ps3fb.dinfo->irq.mask = 0;
1172
1173         ps3av_register_flip_ctl(NULL, NULL);
1174         if (ps3fb.task) {
1175                 struct task_struct *task = ps3fb.task;
1176                 ps3fb.task = NULL;
1177                 kthread_stop(task);
1178         }
1179         if (ps3fb.irq_no) {
1180                 free_irq(ps3fb.irq_no, &dev->core);
1181                 ps3_irq_plug_destroy(ps3fb.irq_no);
1182         }
1183         if (info) {
1184                 unregister_framebuffer(info);
1185                 fb_dealloc_cmap(&info->cmap);
1186                 framebuffer_release(info);
1187                 info = dev->core.driver_data = NULL;
1188         }
1189         iounmap((u8 __iomem *)ps3fb.dinfo);
1190
1191         status = lv1_gpu_context_free(ps3fb.context_handle);
1192         if (status)
1193                 dev_dbg(&dev->core, "lv1_gpu_context_free failed: %d\n",
1194                         status);
1195
1196         status = lv1_gpu_memory_free(ps3fb.memory_handle);
1197         if (status)
1198                 dev_dbg(&dev->core, "lv1_gpu_memory_free failed: %d\n",
1199                         status);
1200
1201         ps3_close_hv_device(dev);
1202         dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
1203
1204         return 0;
1205 }
1206
1207 static struct ps3_system_bus_driver ps3fb_driver = {
1208         .match_id       = PS3_MATCH_ID_GRAPHICS,
1209         .core.name      = DEVICE_NAME,
1210         .core.owner     = THIS_MODULE,
1211         .probe          = ps3fb_probe,
1212         .remove         = ps3fb_shutdown,
1213         .shutdown       = ps3fb_shutdown,
1214 };
1215
1216 static int __init ps3fb_setup(void)
1217 {
1218         char *options;
1219
1220 #ifdef MODULE
1221         return 0;
1222 #endif
1223
1224         if (fb_get_options(DEVICE_NAME, &options))
1225                 return -ENXIO;
1226
1227         if (!options || !*options)
1228                 return 0;
1229
1230         while (1) {
1231                 char *this_opt = strsep(&options, ",");
1232
1233                 if (!this_opt)
1234                         break;
1235                 if (!*this_opt)
1236                         continue;
1237                 if (!strncmp(this_opt, "mode:", 5))
1238                         ps3fb_mode = simple_strtoul(this_opt + 5, NULL, 0);
1239                 else
1240                         mode_option = this_opt;
1241         }
1242         return 0;
1243 }
1244
1245 static int __init ps3fb_init(void)
1246 {
1247         if (!ps3fb_videomemory.address ||  ps3fb_setup())
1248                 return -ENXIO;
1249
1250         return ps3_system_bus_driver_register(&ps3fb_driver);
1251 }
1252
1253 static void __exit ps3fb_exit(void)
1254 {
1255         pr_debug(" -> %s:%d\n", __func__, __LINE__);
1256         ps3_system_bus_driver_unregister(&ps3fb_driver);
1257         pr_debug(" <- %s:%d\n", __func__, __LINE__);
1258 }
1259
1260 module_init(ps3fb_init);
1261 module_exit(ps3fb_exit);
1262
1263 MODULE_LICENSE("GPL");
1264 MODULE_DESCRIPTION("PS3 GPU Frame Buffer Driver");
1265 MODULE_AUTHOR("Sony Computer Entertainment Inc.");
1266 MODULE_ALIAS(PS3_MODULE_ALIAS_GRAPHICS);