From 53a835f5057367679eb3db728bbdd427aab8aa8a Mon Sep 17 00:00:00 2001 From: Wengang Wu Date: Wed, 21 May 2014 09:29:41 -0500 Subject: IKXCLOCK-1501 Upgrade to TI SGX Android OpenGL 1.12@2701748 Initial codes of TI SGX DDK 1.12@2701748 Change-Id: I75a8f6521968346ea1b2ea9fa54817ba186442ce --- drivers/gpu/pvr/services4/srvkm/env/linux/module.c | 100 ++++++++++++--------- 1 file changed, 57 insertions(+), 43 deletions(-) mode change 100644 => 100755 drivers/gpu/pvr/services4/srvkm/env/linux/module.c (limited to 'drivers/gpu/pvr/services4/srvkm/env/linux/module.c') diff --git a/drivers/gpu/pvr/services4/srvkm/env/linux/module.c b/drivers/gpu/pvr/services4/srvkm/env/linux/module.c old mode 100644 new mode 100755 index 487069daf46..a86de684c0a --- a/drivers/gpu/pvr/services4/srvkm/env/linux/module.c +++ b/drivers/gpu/pvr/services4/srvkm/env/linux/module.c @@ -83,7 +83,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include + +#ifdef CONFIG_OF +#include +#endif #if defined(SUPPORT_DRI_DRM) #include @@ -129,6 +132,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "lock.h" #include "linkage.h" #include "buffer_manager.h" +#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) +#include "pvr_sync.h" +#endif + +#if defined(SUPPORT_PVRSRV_ANDROID_SYSTRACE) +#include "systrace.h" +#endif #if defined(SUPPORT_DRI_DRM) #include "pvr_drm.h" @@ -160,19 +170,16 @@ module_param(gPVRDebugLevel, uint, 0644); MODULE_PARM_DESC(gPVRDebugLevel, "Sets the level of debug output (default 0x7)"); #endif /* defined(PVRSRV_NEED_PVR_DPF) */ -#if defined(CONFIG_ION_OMAP) -#include -#include -#include "ion.h" -extern void omap_ion_register_pvr_export(void *); -extern struct ion_device *omap_ion_device; -struct ion_client *gpsIONClient; -EXPORT_SYMBOL(gpsIONClient); -#endif /* defined(CONFIG_ION_OMAP) */ +/* Newer kernels no longer support __devinitdata */ +#if !defined(__devinitdata) +#define __devinitdata +#endif +#if defined(SUPPORT_PVRSRV_DEVICE_CLASS) /* PRQA S 3207 2 */ /* ignore 'not used' warning */ EXPORT_SYMBOL(PVRGetDisplayClassJTable); EXPORT_SYMBOL(PVRGetBufferClassJTable); +#endif /* defined(SUPPORT_PVRSRV_DEVICE_CLASS) */ #if defined(PVR_LDM_DEVICE_CLASS) && !defined(SUPPORT_DRI_DRM) /* @@ -262,10 +269,21 @@ static struct platform_device_id powervr_id_table[] __devinitdata = { }; #endif +#ifdef CONFIG_OF +static const struct of_device_id omap_gpu_id_table[] = { + { .compatible = "ti,omap4-gpu" }, + {} +}; +MODULE_DEVICE_TABLE(of, omap_gpu_id_table); +#endif + static LDM_DRV powervr_driver = { #if defined(PVR_LDM_PLATFORM_MODULE) .driver = { .name = DRVNAME, +#ifdef CONFIG_OF + .of_match_table = of_match_ptr(omap_gpu_id_table), +#endif }, #endif #if defined(PVR_LDM_PCI_MODULE) @@ -355,20 +373,6 @@ static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device } } -#if defined(CONFIG_ION_OMAP) - gpsIONClient = ion_client_create(omap_ion_device, - 1 << ION_HEAP_TYPE_CARVEOUT | - 1 << OMAP_ION_HEAP_TYPE_TILER | - 1 << ION_HEAP_TYPE_SYSTEM, - "pvr"); - if (IS_ERR_OR_NULL(gpsIONClient)) - { - PVR_DPF((PVR_DBG_ERROR, "PVRSRVDriverProbe: Couldn't create ion client")); - return PTR_ERR(gpsIONClient); - } - omap_ion_register_pvr_export(&PVRSRVExportFDToIONHandles); -#endif /* defined(CONFIG_ION_OMAP) */ - return 0; } @@ -403,11 +407,6 @@ static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice) PVR_TRACE(("PVRSRVDriverRemove(pDevice=%p)", pDevice)); -#if defined(CONFIG_ION_OMAP) - ion_client_destroy(gpsIONClient); - gpsIONClient = IMG_NULL; -#endif - SysAcquireData(&psSysData); #if defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) @@ -473,7 +472,7 @@ PVR_MOD_STATIC void PVRSRVDriverShutdown(LDM_DEV *pDevice) { PVR_TRACE(("PVRSRVDriverShutdown(pDevice=%p)", pDevice)); - LinuxLockMutex(&gsPMMutex); + LinuxLockMutexNested(&gsPMMutex, PVRSRV_LOCK_CLASS_POWER); if (!bDriverIsShutdown && !bDriverIsSuspended) { @@ -482,7 +481,7 @@ PVR_MOD_STATIC void PVRSRVDriverShutdown(LDM_DEV *pDevice) * processes trying to use the driver after it has been * shutdown. */ - LinuxLockMutex(&gPVRSRVLock); + LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); (void) PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3); } @@ -539,11 +538,11 @@ PVR_MOD_STATIC int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state) #if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) PVR_TRACE(( "PVRSRVDriverSuspend(pDevice=%p)", pDevice)); - LinuxLockMutex(&gsPMMutex); + LinuxLockMutexNested(&gsPMMutex, PVRSRV_LOCK_CLASS_POWER); if (!bDriverIsSuspended && !bDriverIsShutdown) { - LinuxLockMutex(&gPVRSRVLock); + LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); if (PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3) == PVRSRV_OK) { @@ -596,7 +595,7 @@ PVR_MOD_STATIC int PVRSRVDriverResume(LDM_DEV *pDevice) #if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) PVR_TRACE(("PVRSRVDriverResume(pDevice=%p)", pDevice)); - LinuxLockMutex(&gsPMMutex); + LinuxLockMutexNested(&gsPMMutex, PVRSRV_LOCK_CLASS_POWER); if (bDriverIsSuspended && !bDriverIsShutdown) { @@ -709,10 +708,10 @@ void ProcSeqShowPowerLevel(struct seq_file *sfile,void* el) @Description - Release access the PVR services node - called when a file is closed, whether - at exit or using close(2) system call. + Open the PVR services node - called when the relevant device node is open()ed. @input pInode - the inode for the file being openeded + @input dev - the DRM device corresponding to this driver. @input pFile - the file handle data for the actual file being opened @@ -734,7 +733,7 @@ static int PVRSRVOpen(struct inode unref__ * pInode, struct file *pFile) PVRSRV_ENV_PER_PROCESS_DATA *psEnvPerProc; #endif - LinuxLockMutex(&gPVRSRVLock); + LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); ui32PID = OSGetCurrentProcessIDKM(); @@ -759,11 +758,7 @@ static int PVRSRVOpen(struct inode unref__ * pInode, struct file *pFile) if(eError != PVRSRV_OK) goto err_unlock; -#if defined (SUPPORT_SID_INTERFACE) - psPrivateData->hKernelMemInfo = 0; -#else psPrivateData->hKernelMemInfo = NULL; -#endif #if defined(SUPPORT_DRI_DRM) && defined(PVR_SECURE_DRM_AUTH_EXPORT) psPrivateData->psDRMFile = pFile; @@ -805,7 +800,7 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile) PVRSRV_FILE_PRIVATE_DATA *psPrivateData; int err = 0; - LinuxLockMutex(&gPVRSRVLock); + LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); #if defined(SUPPORT_DRI_DRM) psPrivateData = (PVRSRV_FILE_PRIVATE_DATA *)pvPrivData; @@ -925,6 +920,8 @@ static int __init PVRCore_Init(void) struct device *psDev; #endif + + #if !defined(SUPPORT_DRI_DRM) /* * Must come before attempting to print anything via Services. @@ -960,6 +957,7 @@ static int __init PVRCore_Init(void) } LinuxBridgeInit(); + PVRMMapInit(); @@ -1054,6 +1052,13 @@ static int __init PVRCore_Init(void) #endif /* defined(PVR_LDM_DEVICE_CLASS) */ #endif /* !defined(SUPPORT_DRI_DRM) */ +#if defined(SUPPORT_PVRSRV_ANDROID_SYSTRACE) + SystraceCreateFS(); +#endif + +#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) + PVRSyncDeviceInit(); +#endif return 0; #if !defined(SUPPORT_DRI_DRM) @@ -1063,6 +1068,8 @@ destroy_class: unregister_device: unregister_chrdev((IMG_UINT)AssignedMajorNumber, DEVNAME); #endif +#endif +#if !defined(SUPPORT_DRI_DRM) sys_deinit: #endif #if defined(PVR_LDM_MODULE) @@ -1095,7 +1102,6 @@ init_failed: LinuxBridgeDeInit(); PVROSFuncDeInit(); RemoveProcEntries(); - return error; } /*PVRCore_Init*/ @@ -1141,6 +1147,10 @@ static void __exit PVRCore_Cleanup(void) SysAcquireData(&psSysData); #endif +#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) + PVRSyncDeviceDeInit(); +#endif + #if !defined(SUPPORT_DRI_DRM) #if defined(PVR_LDM_DEVICE_CLASS) @@ -1199,6 +1209,10 @@ static void __exit PVRCore_Cleanup(void) RemoveProcEntries(); +#if defined(SUPPORT_PVRSRV_ANDROID_SYSTRACE) + SystraceDestroyFS(); +#endif + PVR_TRACE(("PVRCore_Cleanup: unloading")); } -- cgit v1.2.3-70-g09d2