From e911ee2e349fd1462749547447cae95250560b3d Mon Sep 17 00:00:00 2001 From: ZhuangXiaoLiang Date: Mon, 6 Nov 2017 21:20:41 +0800 Subject: [PATCH] RK3368 GPU: Update to Rogue 5.13. Add gpu performance interface for cts. Change-Id: I6d0259e97b4fe140eb1e63196e1008adf4a33c66 Signed-off-by: ZhuangXiaoLiang --- drivers/staging/imgtec/pvr_drm.c | 28 +++++++++++++++++++ drivers/staging/imgtec/pvrversion.h | 4 ++- .../staging/imgtec/rogue/pvr_dvfs_device.c | 3 ++ .../staging/imgtec/rogue/pvr_dvfs_device.h | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/staging/imgtec/pvr_drm.c b/drivers/staging/imgtec/pvr_drm.c index 72e5b4f5d59f..24def946a82f 100644 --- a/drivers/staging/imgtec/pvr_drm.c +++ b/drivers/staging/imgtec/pvr_drm.c @@ -214,6 +214,33 @@ static long pvr_compat_ioctl(struct file *file, unsigned int cmd, } #endif /* defined(CONFIG_COMPAT) */ +int g_gpu_performance = -1; +static ssize_t PVRSRV_Perf_Write(struct file *pfile, const char __user *ubuf, + size_t count, loff_t *ploff) +{ + char kbuf[10]; + long enable = -1; + + if (count > sizeof(kbuf)) + count = sizeof(kbuf); + + if (copy_from_user(kbuf, ubuf, count)) { + DRM_ERROR("%s: copy_to_user failed!\n", __func__); + return -EFAULT; + } + + kbuf[count - 1] = '\0'; + if (kstrtol(kbuf, 10, &enable) != 0) { + DRM_ERROR("%s: kstrtol failed!\n", __func__); + return -EFAULT; + } + + if (g_gpu_performance != enable) + g_gpu_performance = enable; + + return count; +} + static const struct file_operations pvr_drm_fops = { .owner = THIS_MODULE, .open = drm_open, @@ -231,6 +258,7 @@ static const struct file_operations pvr_drm_fops = { .mmap = PVRSRV_MMap, .poll = drm_poll, .read = drm_read, + .write = PVRSRV_Perf_Write, #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)) .fasync = drm_fasync, #endif diff --git a/drivers/staging/imgtec/pvrversion.h b/drivers/staging/imgtec/pvrversion.h index fc1391c4f055..8312a2d18313 100644 --- a/drivers/staging/imgtec/pvrversion.h +++ b/drivers/staging/imgtec/pvrversion.h @@ -128,6 +128,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * N 5.12 * 1. Fix PVRSRVDevicePreClockSpeedChange failed. * 2. Apply PP_fix_KM patch from IMG. + * N 5.13 + * Add gpu performance interface for cts. */ #define PVR_STR(X) #X @@ -155,5 +157,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PVRVERSION_UNPACK_MIN(VERSION) (((VERSION) >> 0) & 0xFFFF) //chenli:define rockchip version -#define RKVERSION "Rogue N 5.12" +#define RKVERSION "Rogue N 5.13" #endif /* _PVRVERSION_H_ */ diff --git a/drivers/staging/imgtec/rogue/pvr_dvfs_device.c b/drivers/staging/imgtec/rogue/pvr_dvfs_device.c index 59c8f4a839db..94804a43dba3 100644 --- a/drivers/staging/imgtec/rogue/pvr_dvfs_device.c +++ b/drivers/staging/imgtec/rogue/pvr_dvfs_device.c @@ -100,6 +100,9 @@ static IMG_INT32 devfreq_target(struct device *dev, long unsigned *requested_fre return 0; } + if (g_gpu_performance == 1) + *requested_freq = psDVFSDevice->psDevFreq->max_freq; + rcu_read_lock(); opp = devfreq_recommended_opp(dev, requested_freq, flags); if (IS_ERR(opp)) { diff --git a/drivers/staging/imgtec/rogue/pvr_dvfs_device.h b/drivers/staging/imgtec/rogue/pvr_dvfs_device.h index 010caa0c2080..d7385f49fefd 100644 --- a/drivers/staging/imgtec/rogue/pvr_dvfs_device.h +++ b/drivers/staging/imgtec/rogue/pvr_dvfs_device.h @@ -48,6 +48,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "pvrsrv_error.h" #include "img_types.h" +extern int g_gpu_performance; + PVRSRV_ERROR InitDVFS(PVRSRV_DEVICE_NODE *psDeviceNode); void DeinitDVFS(PVRSRV_DEVICE_NODE *psDeviceNode);