From: Imre Deak Date: Fri, 27 Jan 2012 16:27:31 +0000 (+0200) Subject: gfx: pvr: fix SGX_READ_HWPERF IOCTL according to v1.7 ABI X-Git-Tag: 2.1b_release~341 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17720d6ec581ccb1d181ee8075192c7cc5f47086;p=kernel%2Fkernel-mfld-blackbay.git gfx: pvr: fix SGX_READ_HWPERF IOCTL according to v1.7 ABI There has been a change in the parameters for this IOCTL in v1.7 of the driver. While the userspace library was updated accordingly we didn't do this on the kernel side. We missed the difference since the size of the structure wasn't checked against the user space version. The next patch will add this check to avoid similar problems in the future. Signed-off-by: Imre Deak Tested-by: Pauli Nieminen Signed-off-by: Kirill A. Shutemov --- diff --git a/drivers/staging/mrst/pvr/include4/sgxapi_km.h b/drivers/staging/mrst/pvr/include4/sgxapi_km.h index 737e21f..150cd6d 100644 --- a/drivers/staging/mrst/pvr/include4/sgxapi_km.h +++ b/drivers/staging/mrst/pvr/include4/sgxapi_km.h @@ -83,12 +83,13 @@ extern "C" { #define SGX_MAX_DST_SYNCS 1 #endif - #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS) -#define PVRSRV_SGX_HWPERF_NUM_COUNTERS 8 +#define PVRSRV_SGX_HWPERF_NUM_COUNTERS 8 +#define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 11 #else -#define PVRSRV_SGX_HWPERF_NUM_COUNTERS 9 -#endif +#define PVRSRV_SGX_HWPERF_NUM_COUNTERS 9 +#define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 8 +#endif #define PVRSRV_SGX_HWPERF_INVALID 0x1 @@ -143,11 +144,14 @@ extern "C" { typedef struct _PVRSRV_SGX_HWPERF_CB_ENTRY_ { IMG_UINT32 ui32FrameNo; + IMG_UINT32 ui32PID; + IMG_UINT32 ui32RTData; IMG_UINT32 ui32Type; IMG_UINT32 ui32Ordinal; IMG_UINT32 ui32Info; IMG_UINT32 ui32Clocksx16; - IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS]; } PVRSRV_SGX_HWPERF_CB_ENTRY; diff --git a/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h b/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h index 93578c2..8fd42e6 100644 --- a/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h +++ b/drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h @@ -318,12 +318,16 @@ typedef struct _PVRSRV_SGX_MISCINFO_INFO typedef struct _SGXMKIF_HWPERF_CB_ENTRY_ { IMG_UINT32 ui32FrameNo; + IMG_UINT32 ui32PID; + IMG_UINT32 ui32RTData; + IMG_UINT32 ui32Type; IMG_UINT32 ui32Ordinal; IMG_UINT32 ui32Info; IMG_UINT32 ui32TimeWraps; IMG_UINT32 ui32Time; - IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS]; + IMG_UINT32 ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS]; } SGXMKIF_HWPERF_CB_ENTRY; typedef struct _SGXMKIF_HWPERF_CB_ diff --git a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c index 54f3fec..f797da5 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c +++ b/drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c @@ -2751,6 +2751,9 @@ PVRSRV_ERROR SGXReadHWPerfCBKM(IMG_HANDLE hDevHandle, SGXMKIF_HWPERF_CB_ENTRY *psMKPerfEntry = &psHWPerfCB->psHWPerfCBData[psHWPerfCB->ui32Roff]; psClientHWPerfEntry[i].ui32FrameNo = psMKPerfEntry->ui32FrameNo; + psClientHWPerfEntry[i].ui32PID = psMKPerfEntry->ui32PID; + psClientHWPerfEntry[i].ui32RTData = psMKPerfEntry->ui32RTData; + psClientHWPerfEntry[i].ui32Type = psMKPerfEntry->ui32Type; psClientHWPerfEntry[i].ui32Ordinal = psMKPerfEntry->ui32Ordinal; psClientHWPerfEntry[i].ui32Info = psMKPerfEntry->ui32Info; @@ -2761,6 +2764,11 @@ PVRSRV_ERROR SGXReadHWPerfCBKM(IMG_HANDLE hDevHandle, &psMKPerfEntry->ui32Counters[0][0], sizeof(psMKPerfEntry->ui32Counters)); + OSMemCopy(&psClientHWPerfEntry[i].ui32MiscCounters[0][0], + &psMKPerfEntry->ui32MiscCounters[0][0], + sizeof(psMKPerfEntry->ui32MiscCounters)); + + psHWPerfCB->ui32Roff = (psHWPerfCB->ui32Roff + 1) & (SGXMKIF_HWPERF_CB_SIZE - 1); } diff --git a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h index 714bea3..8d9e504 100644 --- a/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h +++ b/drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h @@ -188,6 +188,8 @@ #endif #else #define SGX_FEATURE_MP_CORE_COUNT (1) +#define SGX_FEATURE_MP_CORE_COUNT_3D 1 +#define SGX_FEATURE_MP_CORE_COUNT_TA 1 #endif #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && !defined(SUPPORT_SGX_PRIORITY_SCHEDULING)