diff options
author | Richard Zhao <richard.zhao@freescale.com> | 2011-01-18 18:51:20 +0800 |
---|---|---|
committer | Alan Tull <alan.tull@freescale.com> | 2011-02-03 16:44:45 -0600 |
commit | 1dc62c1039ca48898e95e8e30c66a6d0f5d7d41c (patch) | |
tree | e73989eb5d9cad15c455627275bca2b035f20e16 | |
parent | d6ec69b17ce7f741c6af72d38014ccd4d0b83c5c (diff) |
ENGR00138141 GPU: add a wait loop to check timestamp for yamato
When bus is busy, for example vpu is working too, the timestamp is
possiblly not yet refreshed to memory by yamato when we get
GSL_INTR_YDX_CP_RING_BUFFER. For most cases, it will hit on first
loop cycle. So it don't effect performance.
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
-rw-r--r-- | drivers/mxc/amd-gpu/common/gsl_yamato.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/mxc/amd-gpu/common/gsl_yamato.c b/drivers/mxc/amd-gpu/common/gsl_yamato.c index a9a73fa5013d..07c651f57f42 100644 --- a/drivers/mxc/amd-gpu/common/gsl_yamato.c +++ b/drivers/mxc/amd-gpu/common/gsl_yamato.c @@ -19,6 +19,7 @@ #include "gsl.h" #include "gsl_hal.h" #ifdef _LINUX +#include <linux/delay.h> #include <linux/sched.h> #endif @@ -846,6 +847,22 @@ kgsl_yamato_waitirq(gsl_device_t *device, gsl_intrid_t intr_id, unsigned int *co return (status); } +int kgsl_yamato_check_timestamp(gsl_deviceid_t device_id, gsl_timestamp_t timestamp) +{ + int i; + /* Reason to use a wait loop: + * When bus is busy, for example vpu is working too, the timestamp is + * possiblly not yet refreshed to memory by yamato. For most cases, it + * will hit on first loop cycle. So it don't effect performance. + */ + for (i = 0; i < 10; i++) { + if (kgsl_cmdstream_check_timestamp(device_id, timestamp)) + return 1; + udelay(10); + } + return 0; +} + int kgsl_yamato_waittimestamp(gsl_device_t *device, gsl_timestamp_t timestamp, unsigned int timeout) { @@ -854,8 +871,8 @@ kgsl_yamato_waittimestamp(gsl_device_t *device, gsl_timestamp_t timestamp, unsig return kos_event_wait( device->timestamp_event, timeout ); #else int status = wait_event_interruptible_timeout(device->timestamp_waitq, - kgsl_cmdstream_check_timestamp(device->id, timestamp), - msecs_to_jiffies(timeout)); + kgsl_yamato_check_timestamp(device->id, timestamp), + msecs_to_jiffies(timeout)); if (status > 0) return GSL_SUCCESS; else |