A3xx device gets the ring buffer read pointer directly
from the GPU registers. So don’t allocate scratch memory
which can’t be used for A3xx GPU devices.
Change-Id: I95016dfc169b9fee74e978f5560592740f34515e
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Stall on page fault feature is supported on A5XX and later GPUs.
Enabling this feature on unsupported GPUs causes GPU faults.
So don't insert GPU stall related commands in ringbuffer if
not supported. But allow user to capture the GPU snapshot on
GPU page fault.
Change-Id: Ied26a5b4f44c1877b289a0ff5c0a6d47901e453d
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Reduce the frequency of kgsl logging when kgsl driver failed to get
memory mapping for requested memory.
Change-Id: If1a8832a9aa0396e3c990916deec7949697be12d
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
Sparse bind object are unbinded with bind id. This
can be exploited by any malicious application calling
unbind with same bind id again and again.
This can lead to a race condition between two threads
where one free the bind object and second thread uses
same object leading to bad dereference.
Change-Id: I542a008fc647489560667fb5016453a0c3448f7a
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
In case memory pools are supported return the page size as
supported only if corresponding memory pool is available.
This will increase the usage of memory pool and will reduce the
overall allocation time.
Change-Id: Iea84a4259b38fe9cb546419dfcbaf0a9666e7ca9
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Add debug log to dump the GPU speed bin value incase probe
fails due to efused bin value mismatch with speed bin value.
Change-Id: I329523f8dbb82272418981a54a1c2e6cf5e90b85
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Since 'timestamp' is of unsigned int type, for larger timestamp
the format specifier %d can show negative values. Fix this by
using %u format specifier for timestamp.
Change-Id: I621dfd4843099cb27436006500fe3342d1d5ddf4
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
Add a devicetree "disable-wake-on-touch" property support
to disable GPU wake up on touch input events. This will
help save power in case of unintended taps and swipes,
for example, when the screen is wet.
Change-Id: I35768dc78c473272472aaf9c0e09e66d75817b2c
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
There is a possibility of integer overflow in the arithmetic
calculation for cmd_size. Fix this by adding checks for such
arithmetic.
Change-Id: I2298a32f8ba3411decb29f55bb7b55e2214de35a
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
During preemption microcode does save restore for all perf
counters. If we read the power counters at preemption boundary
we might get abnormal value from the perf counter. This will
result in showing incorrect GPU busy percentage. Fix this by
setting the abnormal power perf counter value with zero.
Change-Id: I96ba367ceeeb92d6adb507d0d917113297b4b58d
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
event->handle pointer can be used after free due to
the race condition between kgsl_sync_callback and
kgsl_sync_fence_async_cancel.
Protect the event->handle with a spinlock to
avoid concurrent access issues.
Change-Id: I3719e401af9ece82ac68b72f2aef784c7fdc1104
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
If requested, trace the GPU time to ensure
a useful mapping regardless of the chosen
trace clock.
Change-Id: I76a893975de9a278c8178f935991191354f29e2f
Signed-off-by: Jonathan Wicks <jwicks@codeaurora.org>
Add a PM QOS request to disallow L2PC during wake up
from SLUMBER state. This is required to improve queue
to submit time for first set of GPU commands which results
in GPU wake up.
Change-Id: Iad1a6dfdf9e1fe034eef4fae526138d724bdd3eb
Signed-off-by: Gaurav Sonwani <gsonwani@codeaurora.org>
Set ALLFLATOPTDIS bit in A5XX_VPC_DBG_ECO_CNTL register to
disable VPC all flat shading optimization. ALLFLATOPTDIS is
a hardware chicken bit value needs to be set one, to avoid
UI rendering corruption.
Change-Id: I39b5ad098daacbb1c3b0fc93963d82d477f70cc1
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
For any reason if preemption initialization fails,
we do not free allocated memory for preemption.
Free allocated memory when it fails.
Change-Id: Ie931766f1ec1de7f3a0522054fc1fcb7b9426be6
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
We should have a corresponding syncpoint_fence trace
for every syncpoint_fence_expire trace. In case the
fence is already signaled then make sure to have
syncpoint_fence trace before syncpoint_fence_expire
trace.
Also take an extra refcount for fence which will make
sure that the fence pointer is valid in the trace even
if the fence is signaled.
Change-Id: I2fd8f91c800f89a4a64813a6908eaa0445cf548b
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
For calculation of busy time and total time, KGSL relies on perf
counters and CPU clock. These can be a bit out of sync and may
give GPU busy greater than 100 percent. Updating time at the right
place will give more accurate total time and will avoid crossing
100% in GPU busy calculation.
Change-Id: I3cc702492325b9dc44ea2b705e4d9014d95abd33
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
Change the array index 'i' of pwrlevels[] to unsigned int, which can't be
decremented beyond zero.
Change-Id: I9b646fccf03437f6facf0d5938f097916d13d2f2
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
Make sure to use proper locks when using the
vma_struct_area. This will avoid the race condition
in a scenario where one thread gets a vma_struct_area
and other thread is unmapping the vma from the process.
Change-Id: I6c7837d1a8dd24fc6955ab5be8b1917a42f2cb53
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
There is a dead loop in kgsl_devfreq_target(), while governor request
to change GPU frequency. In governor 'userspace' mode, If the requested
frequency (set_freq) is more than the configured frequency and max_freq
is also set to more than the configured frequency, then there is a dead
loop while changing target frequency.
Dead loop occurs due to comparing signed integer with unsigned integer.
So, type casting unsigned integer to signed integer will terminate the
loop when loop variable is less than zero.
Change-Id: Ic82b7477d50d1abcd348b011f64246066887922c
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
KGSL power limit pointer can be error or NULL. Add a NULL
check for limit pointer to avoid NULL pointer dereference.
Change-Id: I4aacaddd1cd9b34f1befc21807eb7ab577f0a7f1
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Doing a memset to zero while adding a page to pool is not
efficient as the page added to the pool can be returned to
system in case shrinker kicks in. In this scenario, time spent
in zeroing the page is a waste.
Instead of zeroing the page while adding it to pool zero the
page when it is taken from the pool. This helps in reducing
the time taken to free big chunk of memory. Also, allocation
time shouldn't be a problem as zeroing of page anyways happens
during allocation in case it is allocated from system.
Change-Id: I41ab2cb88fb4fd9854d2cc9a45bb60fc7013286a
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Excessive logging due to several successive memory allocation failure
may cause a watchdog bite. Hence, this change adds ratelimit to logging
on memory allocation failure.
Change-Id: I8e5d78918a32c48ef7fa587f3dc63cbd1f065d5f
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
The debug option to always ON the GPU clocks does not check the regulator
state. If the user tries to set this option while GPU is in Slumber state
then enabling clocks will fail.
Make sure we enable the GPU regulators before enabling its clocks.
Change-Id: Id77773224c674fe2e1b6179a039750b24e5e5f87
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
Add all A5XX RBBM status registers to pre-crash dumper
registers list so that snapshot captures the accurate
state of the individual blocks.
Change-Id: I774b84f3cb69b7b0aa119e87229d9ec9c96bbbb4
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
This reverts commit 281fcb5e18.
To address the issue with the OOMkiller causing to kill the
foreground application.
Change-Id: Ie4c078d706fdf1c13ad45840f72b414ddc37c1d0
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Signed-off-by: Venkateswara Rao Tadikonda <vtadik@codeaurora.org>
adreno_dispatch_work and _kgsl_event_worker are both low-latency
low-runtime functions that are in the critical path of GPU
rendering. Moving them out of workqueues and into a dedicated FIFO
kthread avoids significant jitter.
bug 30342017
Git-commit: 1a7a93bd33f48a369de29f6f2b56251127bf6ab4
Git-repo: https://android.googlesource.com/kernel/msm
Change-Id: I83562f488c34c2ab001c8ea79e7f09b633c658bd
Signed-off-by: Tim Murray <timmurray@google.com>
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
In current code, if a request comes to allocate a page of a size
for which pool is not supported EAGAIN is returned with a page
size of PAGE_SIZE << --order. This is not efficient as it results
in multiple retries in case pool of size = PAGE_SIZE << --order is
also not supported.
Instead of retrying with lower order page in a sequential manner
this change directly returns the page size of the pool that is
supported.
Change-Id: Ib82ae5be7e4109fdc0a3d72bcbcd4b47cfb2e266
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
GPU perfcounters gets reset after a soft reset. Currently
GPU busy stats is using previous values after a soft reset.
This might lead to invalid GPU busy calculations. Start GPU
stats from the scratch after a soft reset to get valid GPU
busy calculations.
Change-Id: Ia38c18ad59f438d724ff4710ee2b350853b3810d
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
Currently submit ioctl getting blocked till the commands
gets added to ringbuffer incase inflight count is less
than context burst count. If the submit command happens
in GPU slumber state, it will add the GPU wakeup time to
submit IOCTL. This will add latency in preparing next frame
in CPU side. Defer commands submission to dispatcher worker,
if the GPU is in slumber state.
CRs-Fixed: 2055107
Change-Id: I099ba721e02bbcd8ccadb1bc518c7c1ef4fb7e21
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Handle the clk API return value so that it’s easy
to catch un clocked GPU register access.
Change-Id: I5a1a9a6cbd673394f126bb17b849393268a22b1b
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>