mirror of
https://github.com/revyos/thead-kernel.git
synced 2026-09-17 21:02:13 +02:00
feat: update gpu to Linux_SDK_V1.2.1
This version update involves a lot of content, so the previous version has been deleted and the new version has been re-merged into the kernel. The configuration file for the GPU driver originates from a previous version. Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
This commit is contained in:
@@ -119,7 +119,7 @@ EXPORT_SYMBOL(RGXInitSLC);
|
||||
EXPORT_SYMBOL(RGXHWPerfConnect);
|
||||
EXPORT_SYMBOL(RGXHWPerfDisconnect);
|
||||
EXPORT_SYMBOL(RGXHWPerfControl);
|
||||
#if defined(HWPERF_PACKET_V2C_SIG)
|
||||
#if defined(RGX_FEATURE_HWPERF_VOLCANIC)
|
||||
EXPORT_SYMBOL(RGXHWPerfConfigureCounters);
|
||||
#else
|
||||
EXPORT_SYMBOL(RGXHWPerfConfigMuxCounters);
|
||||
@@ -137,13 +137,34 @@ EXPORT_SYMBOL(OSRemoveTimer);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CONNECTION_DATA *LinuxConnectionFromFile(struct file *pFile)
|
||||
static int PVRSRVDeviceSyncOpen(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
|
||||
struct drm_file *psDRMFile);
|
||||
|
||||
CONNECTION_DATA *LinuxServicesConnectionFromFile(struct file *pFile)
|
||||
{
|
||||
if (pFile)
|
||||
{
|
||||
struct drm_file *psDRMFile = pFile->private_data;
|
||||
PVRSRV_CONNECTION_PRIV *psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
|
||||
|
||||
return psDRMFile->driver_priv;
|
||||
return (CONNECTION_DATA*)psConnectionPriv->pvConnectionData;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CONNECTION_DATA *LinuxSyncConnectionFromFile(struct file *pFile)
|
||||
{
|
||||
if (pFile)
|
||||
{
|
||||
struct drm_file *psDRMFile = pFile->private_data;
|
||||
PVRSRV_CONNECTION_PRIV *psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
|
||||
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
return (CONNECTION_DATA*)psConnectionPriv->pvConnectionData;
|
||||
#else
|
||||
return (CONNECTION_DATA*)psConnectionPriv->pvSyncConnectionData;
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -200,6 +221,21 @@ int PVRSRVDriverInit(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(CONFIG_PROC_FS)
|
||||
error = PVRProcFsRegister();
|
||||
if (error != PVRSRV_OK)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
#elif defined(CONFIG_DEBUG_FS)
|
||||
error = PVRDebugFsRegister();
|
||||
if (error != PVRSRV_OK)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif /* defined(CONFIG_PROC_FS) || defined(CONFIG_DEBUG_FS) */
|
||||
#else
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
error = PVRDebugFsRegister();
|
||||
if (error != PVRSRV_OK)
|
||||
@@ -213,6 +249,7 @@ int PVRSRVDriverInit(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif /* defined(CONFIG_DEBUG_FS) || defined(CONFIG_PROC_FS) */
|
||||
#endif /* defined(ANDROID) */
|
||||
|
||||
error = PVRSRVIonStatsInitialise();
|
||||
if (error != PVRSRV_OK)
|
||||
@@ -410,21 +447,21 @@ int PVRSRVDeviceResume(PVRSRV_DEVICE_NODE *psDeviceNode)
|
||||
}
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function PVRSRVDeviceOpen
|
||||
@Description Common device open.
|
||||
@Function PVRSRVDeviceServicesOpen
|
||||
@Description Services device open.
|
||||
@Input psDeviceNode The device node representing the device being
|
||||
opened by a user mode process
|
||||
@Input psDRMFile The DRM file data that backs the file handle
|
||||
returned to the user mode process
|
||||
@Return int 0 on success and a Linux error code otherwise
|
||||
*/ /***************************************************************************/
|
||||
int PVRSRVDeviceOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
struct drm_file *psDRMFile)
|
||||
int PVRSRVDeviceServicesOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
struct drm_file *psDRMFile)
|
||||
{
|
||||
static DEFINE_MUTEX(sDeviceInitMutex);
|
||||
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
|
||||
ENV_CONNECTION_PRIVATE_DATA sPrivData;
|
||||
void *pvConnectionData;
|
||||
PVRSRV_CONNECTION_PRIV *psConnectionPriv;
|
||||
PVRSRV_ERROR eError;
|
||||
int iErr = 0;
|
||||
|
||||
@@ -449,6 +486,23 @@ int PVRSRVDeviceOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (psDRMFile->driver_priv == NULL)
|
||||
{
|
||||
/* Allocate psConnectionPriv (stores private data and release pfn under driver_priv) */
|
||||
psConnectionPriv = kzalloc(sizeof(*psConnectionPriv), GFP_KERNEL);
|
||||
if (!psConnectionPriv)
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: No memory to allocate driver_priv data", __func__));
|
||||
iErr = -ENOMEM;
|
||||
mutex_unlock(&sDeviceInitMutex);
|
||||
goto fail_alloc_connection_priv;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
|
||||
}
|
||||
|
||||
if (psDeviceNode->eDevState == PVRSRV_DEVICE_STATE_INIT)
|
||||
{
|
||||
eError = PVRSRVCommonDeviceInitialise(psDeviceNode);
|
||||
@@ -458,7 +512,7 @@ int PVRSRVDeviceOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
__func__, PVRSRVGetErrorString(eError)));
|
||||
iErr = -ENODEV;
|
||||
mutex_unlock(&sDeviceInitMutex);
|
||||
goto out;
|
||||
goto fail_device_init;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_RGX)
|
||||
@@ -474,24 +528,125 @@ int PVRSRVDeviceOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
* OSConnectionPrivateDataInit function where we can save it so
|
||||
* we can back reference the file structure from its connection
|
||||
*/
|
||||
eError = PVRSRVCommonConnectionConnect(&pvConnectionData, (void *) &sPrivData);
|
||||
eError = PVRSRVCommonConnectionConnect(&psConnectionPriv->pvConnectionData,
|
||||
(void *)&sPrivData);
|
||||
if (eError != PVRSRV_OK)
|
||||
{
|
||||
iErr = -ENOMEM;
|
||||
goto fail_connect;
|
||||
}
|
||||
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
psConnectionPriv->pfDeviceRelease = PVRSRVCommonConnectionDisconnect;
|
||||
#endif
|
||||
psDRMFile->driver_priv = (void*)psConnectionPriv;
|
||||
goto out;
|
||||
|
||||
fail_connect:
|
||||
fail_device_init:
|
||||
kfree(psConnectionPriv);
|
||||
fail_alloc_connection_priv:
|
||||
out:
|
||||
return iErr;
|
||||
}
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function PVRSRVDeviceSyncOpen
|
||||
@Description Sync device open.
|
||||
@Input psDeviceNode The device node representing the device being
|
||||
opened by a user mode process
|
||||
@Input psDRMFile The DRM file data that backs the file handle
|
||||
returned to the user mode process
|
||||
@Return int 0 on success and a Linux error code otherwise
|
||||
*/ /***************************************************************************/
|
||||
static int PVRSRVDeviceSyncOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
struct drm_file *psDRMFile)
|
||||
{
|
||||
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
|
||||
CONNECTION_DATA *psConnection = NULL;
|
||||
ENV_CONNECTION_PRIVATE_DATA sPrivData;
|
||||
PVRSRV_CONNECTION_PRIV *psConnectionPriv;
|
||||
PVRSRV_ERROR eError;
|
||||
int iErr = 0;
|
||||
|
||||
if (!psPVRSRVData)
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: No device data", __func__));
|
||||
iErr = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (psDRMFile->driver_priv == NULL)
|
||||
{
|
||||
/* Allocate psConnectionPriv (stores private data and release pfn under driver_priv) */
|
||||
psConnectionPriv = kzalloc(sizeof(*psConnectionPriv), GFP_KERNEL);
|
||||
if (!psConnectionPriv)
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: No memory to allocate driver_priv data", __func__));
|
||||
iErr = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
|
||||
}
|
||||
|
||||
/* Allocate connection data area, no stats since process not registered yet */
|
||||
psConnection = kzalloc(sizeof(*psConnection), GFP_KERNEL);
|
||||
if (!psConnection)
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: No memory to allocate connection data", __func__));
|
||||
iErr = -ENOMEM;
|
||||
goto fail_alloc_connection;
|
||||
}
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
psConnectionPriv->pvConnectionData = (void*)psConnection;
|
||||
#else
|
||||
psConnectionPriv->pvSyncConnectionData = (void*)psConnection;
|
||||
#endif
|
||||
|
||||
sPrivData.psDevNode = psDeviceNode;
|
||||
|
||||
/* Call environment specific connection data init function */
|
||||
eError = OSConnectionPrivateDataInit(&psConnection->hOsPrivateData, &sPrivData);
|
||||
if (eError != PVRSRV_OK)
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: OSConnectionPrivateDataInit() failed (%s)",
|
||||
__func__, PVRSRVGetErrorString(eError)));
|
||||
goto fail_private_data_init;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_NATIVE_FENCE_SYNC) && !defined(USE_PVRSYNC_DEVNODE)
|
||||
iErr = pvr_sync_open(pvConnectionData, psDRMFile);
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
iErr = pvr_sync_open(psConnectionPriv->pvConnectionData, psDRMFile);
|
||||
#else
|
||||
iErr = pvr_sync_open(psConnectionPriv->pvSyncConnectionData, psDRMFile);
|
||||
#endif
|
||||
if (iErr)
|
||||
{
|
||||
PVRSRVCommonConnectionDisconnect(pvConnectionData);
|
||||
goto out;
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: pvr_sync_open() failed(%d)",
|
||||
__func__, iErr));
|
||||
goto fail_pvr_sync_open;
|
||||
}
|
||||
#endif
|
||||
|
||||
psDRMFile->driver_priv = pvConnectionData;
|
||||
#if defined(SUPPORT_NATIVE_FENCE_SYNC) && !defined(USE_PVRSYNC_DEVNODE)
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
psConnectionPriv->pfDeviceRelease = pvr_sync_close;
|
||||
#endif
|
||||
#endif
|
||||
psDRMFile->driver_priv = psConnectionPriv;
|
||||
goto out;
|
||||
|
||||
#if defined(SUPPORT_NATIVE_FENCE_SYNC) && !defined(USE_PVRSYNC_DEVNODE)
|
||||
fail_pvr_sync_open:
|
||||
OSConnectionPrivateDataDeInit(psConnection->hOsPrivateData);
|
||||
#endif
|
||||
fail_private_data_init:
|
||||
kfree(psConnection);
|
||||
fail_alloc_connection:
|
||||
kfree(psConnectionPriv);
|
||||
out:
|
||||
return iErr;
|
||||
}
|
||||
@@ -505,18 +660,63 @@ out:
|
||||
@Return void
|
||||
*/ /***************************************************************************/
|
||||
void PVRSRVDeviceRelease(PVRSRV_DEVICE_NODE *psDeviceNode,
|
||||
struct drm_file *psDRMFile)
|
||||
struct drm_file *psDRMFile)
|
||||
{
|
||||
void *pvConnectionData = psDRMFile->driver_priv;
|
||||
|
||||
PVR_UNREFERENCED_PARAMETER(psDeviceNode);
|
||||
|
||||
psDRMFile->driver_priv = NULL;
|
||||
if (pvConnectionData)
|
||||
if (psDRMFile->driver_priv)
|
||||
{
|
||||
PVRSRV_CONNECTION_PRIV *psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
|
||||
|
||||
if (psConnectionPriv->pvConnectionData)
|
||||
{
|
||||
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
|
||||
if (psConnectionPriv->pfDeviceRelease)
|
||||
{
|
||||
psConnectionPriv->pfDeviceRelease(psConnectionPriv->pvConnectionData);
|
||||
}
|
||||
#else
|
||||
if (psConnectionPriv->pvConnectionData)
|
||||
PVRSRVCommonConnectionDisconnect(psConnectionPriv->pvConnectionData);
|
||||
|
||||
#if defined(SUPPORT_NATIVE_FENCE_SYNC) && !defined(USE_PVRSYNC_DEVNODE)
|
||||
pvr_sync_close(pvConnectionData);
|
||||
if (psConnectionPriv->pvSyncConnectionData)
|
||||
pvr_sync_close(psConnectionPriv->pvSyncConnectionData);
|
||||
#endif
|
||||
PVRSRVCommonConnectionDisconnect(pvConnectionData);
|
||||
#endif
|
||||
}
|
||||
|
||||
kfree(psDRMFile->driver_priv);
|
||||
psDRMFile->driver_priv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
drm_pvr_srvkm_init(struct drm_device *dev, void *arg, struct drm_file *psDRMFile)
|
||||
{
|
||||
struct drm_pvr_srvkm_init_data *data = arg;
|
||||
struct pvr_drm_private *priv = dev->dev_private;
|
||||
int iErr = 0;
|
||||
|
||||
switch (data->init_module)
|
||||
{
|
||||
case PVR_SRVKM_SYNC_INIT:
|
||||
{
|
||||
iErr = PVRSRVDeviceSyncOpen(priv->dev_node, psDRMFile);
|
||||
break;
|
||||
}
|
||||
case PVR_SRVKM_SERVICES_INIT:
|
||||
{
|
||||
iErr = PVRSRVDeviceServicesOpen(priv->dev_node, psDRMFile);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
PVR_DPF((PVR_DBG_ERROR, "%s: invalid init_module (%d)",
|
||||
__func__, data->init_module));
|
||||
iErr = -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return iErr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user