/* * linux/drivers/video/ps3fb.c -- PS3 GPU frame buffer device * * Copyright (C) 2006 Sony Computer Entertainment Inc. * Copyright 2006, 2007 Sony Corporation * * This file is based on : * * linux/drivers/video/vfb.c -- Virtual frame buffer device * * Copyright (C) 2002 James Simmons * * Copyright (C) 1997 Geert Uytterhoeven * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. */#include<linux/module.h>#include<linux/kernel.h>#include<linux/errno.h>#include<linux/string.h>#include<linux/mm.h>#include<linux/interrupt.h>#include<linux/console.h>#include<linux/ioctl.h>#include<linux/kthread.h>#include<linux/freezer.h>#include<linux/uaccess.h>#include<linux/fb.h>#include<linux/init.h>#include<asm/abs_addr.h>#include<asm/lv1call.h>#include<asm/ps3av.h>#include<asm/ps3fb.h>#include<asm/ps3.h>#define DEVICE_NAME "ps3fb"#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x101#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x102#define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP 0x600#define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT 0x601#define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC 0x602#define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION (1ULL << 32)#define L1GPU_DISPLAY_SYNC_HSYNC 1#define L1GPU_DISPLAY_SYNC_VSYNC 2#define GPU_CMD_BUF_SIZE (2 * 1024 * 1024)#define GPU_FB_START (64 * 1024)#define GPU_IOIF (0x0d000000UL)#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64)#define GPU_MAX_LINE_LENGTH (65536 - 64)#define PS3FB_FULL_MODE_BIT 0x80#define GPU_INTR_STATUS_VSYNC_0 0 /* vsync on head A */#define GPU_INTR_STATUS_VSYNC_1 1 /* vsync on head B */#define GPU_INTR_STATUS_FLIP_0 3 /* flip head A */#define GPU_INTR_STATUS_FLIP_1 4 /* flip head B */#define GPU_INTR_STATUS_QUEUE_0 5 /* queue head A */#define GPU_INTR_STATUS_QUEUE_1 6 /* queue head B */#define GPU_DRIVER_INFO_VERSION 0x211/* gpu internals */structdisplay_head{u64be_time_stamp;u32status;u32offset;u32res1;u32res2;u32field;u32reserved1;u64res3;u32raster;u64vblank_count;u32field_vsync;u32reserved2;};structgpu_irq{u32irq_outlet;u32status;u32mask;u32video_cause;u32graph_cause;u32user_cause;u32res1;u64res2;u32reserved[4];};structgpu_driver_info{u32version_driver;u32version_gpu;u32memory_size;u32hardware_channel;u32nvcore_frequency;u32memory_frequency;u32reserved[1063];structdisplay_headdisplay_head[8];structgpu_irqirq;};structps3fb_priv{unsignedintirq_no;u64context_handle,memory_handle;void*xdr_ea;size_txdr_size;structgpu_driver_info*dinfo;u64vblank_count;/* frame count */wait_queue_head_twait_vsync;atomic_text_flip;/* on/off flip with vsync */