1
/**********************************************************************
3
* Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
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.
9
* This program is distributed in the hope it will be useful but, except
10
* as otherwise stated in writing, without any warranty; without even the
11
* implied warranty of merchantability or fitness for a particular purpose.
12
* See the GNU General Public License for more details.
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.
18
* The full GNU General Public License is included in this distribution in
19
* the file called "COPYING".
21
* Contact Information:
22
* Imagination Technologies Ltd. <gpl-support@imgtec.com>
23
* Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25
******************************************************************************/
30
/* max number of overlays to which a framebuffer data can be direct */
31
#define OMAPFB_MAX_OVL_PER_FB 3
33
extern IMG_BOOL PVRGetDisplayClassJTable(PVRSRV_DC_DISP2SRV_KMJTABLE *psJTable);
35
typedef void * OMAP_HANDLE;
37
typedef enum tag_omap_bool
41
} OMAP_BOOL, *OMAP_PBOOL;
43
typedef struct OMAPLFB_BUFFER_TAG
45
unsigned long ulBufferSize;
46
IMG_SYS_PHYADDR sSysAddr;
47
IMG_CPU_VIRTADDR sCPUVAddr;
48
PVRSRV_SYNC_DATA* psSyncData;
49
struct OMAPLFB_BUFFER_TAG* psNext;
53
typedef struct OMAPLFB_FLIP_ITEM_TAG
55
OMAP_HANDLE hCmdComplete;
56
unsigned long ulSwapInterval;
59
OMAP_BOOL bCmdCompleted;
60
IMG_SYS_PHYADDR* sSysAddr;
64
typedef struct PVRPDP_SWAPCHAIN_TAG
66
unsigned int uiSwapChainID;
67
unsigned long ulBufferCount;
68
OMAPLFB_BUFFER* psBuffer;
69
OMAPLFB_FLIP_ITEM* psFlipItems;
70
unsigned long ulInsertIndex;
71
unsigned long ulRemoveIndex;
72
PVRSRV_DC_DISP2SRV_KMJTABLE* psPVRJTable;
73
OMAP_BOOL bFlushCommands;
74
unsigned long ulSetFlushStateRefCount;
76
spinlock_t* psSwapChainLock;
81
typedef struct OMAPLFB_FBINFO_TAG
83
unsigned long ulFBSize;
84
unsigned long ulBufferSize;
85
unsigned long ulRoundedBufferSize;
86
unsigned long ulWidth;
87
unsigned long ulHeight;
88
unsigned long ulByteStride;
89
IMG_SYS_PHYADDR sSysAddr;
90
IMG_CPU_VIRTADDR sCPUVAddr;
91
PVRSRV_PIXEL_FORMAT ePixelFormat;
95
typedef struct OMAPLFB_DEVINFO_TAG
97
unsigned int uiSwapChainID;
99
OMAPLFB_BUFFER sSystemBuffer;
100
PVRSRV_DC_DISP2SRV_KMJTABLE sPVRJTable;
101
PVRSRV_DC_SRV2DISP_KMJTABLE sDCJTable;
102
OMAPLFB_FBINFO sFBInfo;
103
OMAPLFB_SWAPCHAIN* psSwapChain;
104
OMAP_BOOL bFlushCommands;
105
struct fb_info* psLINFBInfo;
106
struct notifier_block sLINNotifBlock;
107
OMAP_BOOL bDeviceSuspended;
108
struct mutex sSwapChainLockMutex;
109
IMG_DEV_VIRTADDR sDisplayDevVAddr;
110
DISPLAY_INFO sDisplayInfo;
111
DISPLAY_FORMAT sDisplayFormat;
112
DISPLAY_DIMS sDisplayDim;
113
struct workqueue_struct* sync_display_wq;
114
struct work_struct sync_display_work;
115
#if defined(SUPPORT_DRI_DRM)
120
typedef enum _OMAP_ERROR_
123
OMAP_ERROR_GENERIC = 1,
124
OMAP_ERROR_OUT_OF_MEMORY = 2,
125
OMAP_ERROR_TOO_FEW_BUFFERS = 3,
126
OMAP_ERROR_INVALID_PARAMS = 4,
127
OMAP_ERROR_INIT_FAILURE = 5,
128
OMAP_ERROR_CANT_REGISTER_CALLBACK = 6,
129
OMAP_ERROR_INVALID_DEVICE = 7,
130
OMAP_ERROR_DEVICE_REGISTER_FAILED = 8
134
#define OMAPLFB_PAGE_SIZE 4096
135
#define OMAPLFB_PAGE_MASK (OMAPLFB_PAGE_SIZE - 1)
136
#define OMAPLFB_PAGE_TRUNC (~OMAPLFB_PAGE_MASK)
138
#define OMAPLFB_PAGE_ROUNDUP(x) (((x)+OMAPLFB_PAGE_MASK) & OMAPLFB_PAGE_TRUNC)
140
#define DISPLAY_DEVICE_NAME "PowerVR OMAP Linux Display Driver"
141
#define DRVNAME "omaplfb"
142
#define DEVNAME DRVNAME
143
#define DRIVER_PREFIX DRVNAME
145
#define FRAMEBUFFER_COUNT num_registered_fb
148
#define DEBUG_PRINTK(format, ...) printk("DEBUG " DRIVER_PREFIX \
149
" (%s %i): " format "\n", __func__, __LINE__, ## __VA_ARGS__)
151
#define DEBUG_PRINTK(format,...)
154
#define WARNING_PRINTK(format, ...) printk("WARNING " DRIVER_PREFIX \
155
" (%s %i): " format "\n", __func__, __LINE__, ## __VA_ARGS__)
156
#define ERROR_PRINTK(format, ...) printk("ERROR " DRIVER_PREFIX \
157
" (%s %i): " format "\n", __func__, __LINE__, ## __VA_ARGS__)
159
OMAP_ERROR OMAPLFBInit(void);
160
OMAP_ERROR OMAPLFBDeinit(void);
161
OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo);
162
void *OMAPLFBAllocKernelMem(unsigned long ulSize);
163
void OMAPLFBFreeKernelMem(void *pvMem);
164
void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo,
165
OMAPLFB_FLIP_ITEM *psFlipItem);
166
void OMAPLFBPresentSyncAddr(OMAPLFB_DEVINFO *psDevInfo, unsigned long aPhyAddr);
167
OMAP_ERROR OMAPLFBGetLibFuncAddr(char *szFunctionName,
168
PFN_DC_GET_PVRJTABLE *ppfnFuncTable);
169
void OMAPLFBFlip(OMAPLFB_SWAPCHAIN *psSwapChain, unsigned long aPhyAddr);
171
void OMAPLFBDriverSuspend(void);
172
void OMAPLFBDriverResume(void);