The camera generic buffer manager and isp buffer
manager keep references of vb2 buffers locally during
buffer circulation. If for some reason the vb2 buffers
are freed from a cleanup call from mediaserver. The memory
for the buffers is freed. But the camera buffer managers
still access them for a fraction of time before the cleanup
call is triggered from daemon process. Hence make sure
to access the vb2 buffers only after checking for
the existence in vb2 queues to avoid memory corruption.
Change-Id: I7a1e5f9a3af3345e0c37d3208facbab107a6b9ed
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
The pointer qbuf_buf comes from userspace.
qbuf_buf->num_planes is used with no bound check,
which if set to a large value, it will overflow
buf_info->mapped_info and qbuf_buf->planes
CRs-Fixed: 2003798
Change-Id: I332e0424e57bb14b481a740604a09350e6f029a8
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
In msm_isp_get_bufq, if bufq_index equals buf_mgr->num_buf_q,
it will pass the check, leading to off-by-one overflow
(exceed the length of array by one element).
CRs-Fixed: 2031677
Change-Id: I7ea465897e2c37de6ca0155c3e225f1444b3cf13
Signed-off-by: Gaoxiang Chen <gaochen@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
-Use %pK for kernel address to avoid the information leak.
CRs-Fixed: 2009672
Change-Id: Ib0631d5578aba033510babe4f43e2a63bb959747
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
changes to clean share_list when buffer state is
not DEQUEUED or UNSUED.
Change-Id: Ie69d96dd4ffa65bfb673d5237a454e1ca3dabe33
Signed-off-by: Srikanth Uyyala <suyyala@codeaurora.org>
Add changes to track buffer being added to list. Add error
messages if buffer is found to be added twice.
Change-Id: I1e10324710e9d6bc0eb594d289b123d78b035d3e
Signed-off-by: Venu Yeshala <vyeshala@codeaurora.org>
Sync same buffer for pings and pongs
for dual isp
Change-Id: Idc43f589ac52c360384cb0333fa4812765138a6c
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
Adding support to map buffer in fetch engine driver on the fly.
This is needed for Offline reprocess mode of offline ISP.
Added ioctl to unmap buffer after fetch read done, which are
not part of any bufq/stream.
Change-Id: I25eb7e3fe6218b51f94a7f835393aa40eb1ad611
Signed-off-by: Sagar Gore <sgore@codeaurora.org>
Init node before adding it to the tail of linked list.
Change-Id: Idd3c550f4c865b3c7f4a98b3952692f3d8b0ef7f
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
flush the list properly in case of buffer overflow
so this will avoid duplicate list add.
Change-Id: Iae87d27c3b92e4e58cf45afad0d1096b8cfe9361
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
When smmu fault happen, enforce halt and never restart.
This makes sure the HW will not be on by any chance.
Change-Id: I84eba909132f831d4eab0c40b46496fd4ee666ad
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
The check for frameID sanity/consistency is now moved
to the userspace.
Don't reset the put buf count in case of config pingpong
buffer failure.
Rate limit a couple of error messages.
Change-Id: I1f1ede9d318553bd72295b62c9f82699aa142a0a
Signed-off-by: Venu Yeshala <vyeshala@codeaurora.org>
When CPU do spin lock irq save, it will disable preemption.
If the same CPU do spin lock without disabling preemption,
then second spin lock irq save will hang forever since
the preemption is disabled.
Change-Id: I19dfade29a1a318daf9d9c94ef6a494992cd565f
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
return value was getting overwritten after resetting
buf cnt leading to false buf done. We are now making sure
that value gets accumulated.
Change-Id: Ie4c5f3ad8d84593f96004049ef46bdb98123cb98
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
Avoid sending duplicate frame ids and
timestamps to userspace in order to avoid
recording failures.
Change-Id: I899bb9dbfa457e602977551794de8da0a362e74d
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
when camera system goes wrong, driver should still avoid
print per irq log since it could lead to irq starving
and watch dog bark.
Change-Id: Ie7f25dd09e328089418a7ec79375f8d865a3fc10
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
Incase of framedrop, reset the put buf count.
Change-Id: I6b81d73161462a5a2fd5a3a4b1866a913b0004fd
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
In error case where only one VFE is outputing we need to make
sure that shared list doesnt grow indefinately. We need to
drop the particular buffer.
Change-Id: I7dae0ec15a4b8c7b1f8ef62bdf9b3a02581a63d7
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
List corruption can happen due to stale entries in the list. Also, list
corruption can happen if we add the same buffer twice to the shared list.
With this fix,
1. Whenever we get a flush call, we clear all elements in the
shared list.
2. Changed the list_del_init api to list_del.
3. Added bufq lock protection to msm_isp_update_put_buf_cnt.
Change-Id: I0ea4bd8bf706c3871e2f280f80f6e70c37d9eb36
Signed-off-by: Nagesh Reddy <nageshsreddy@codeaurora.org>
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
flush the list properly in case of buffer overflow
so this will avoid duplicate list add.
Change-Id: Idf7e5f2d1831cdc9c7cbee95fbbada53b08435f0
Signed-off-by: Ramesh V <ramev@codeaurora.org>
RDI stream active flag was not set on start_stream. Hence stop_stream
was returning without wait for stop WM. On return the buffer is
released causing IOMMU page fault. Update the active flag correctly
on start and stop to fix this.
Change-Id: I3872e82df4458f4d30db4845301109f0ae9a9ab7
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
List corruption can happen due to stale entries in the list. Also, list
corruption can happen if we add the same buffer twice to the shared list.
With this fix,
1. Whenever we get a flush call, we clear all elements in the
shared list.
2. Changed the list_del_init api to list_del.
3. Added bufq lock protection to msm_isp_update_put_buf_cnt.
Change-Id: I0ea4bd8bf706c3871e2f280f80f6e70c37d9eb36
Signed-off-by: Nagesh Reddy <nageshsreddy@codeaurora.org>
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
In error case where only one VFE is outputing we need to make
sure that shared list doesnt grow indefinately. We need to
drop the particular buffer.
Change-Id: I7dae0ec15a4b8c7b1f8ef62bdf9b3a02581a63d7
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
In case of dual vfe, both vfe hardware is used for same camera
sensor. There are two tasklets serving irq's from each vfe. This
causes synchronization issues if either one of tasklet is delayed.
To fix this, implement synchoranization for dual vfe by using
right vfe to configure the image buffer for both vfe's and
Stats buffer to configure when we get the buffer for both vfe's.
Change-Id: If090bb7526c8d4f544f78e6a9378ebd382253940
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
Move the lock responsibility from calling method to the place
where the mutually exclusive code executes. This will prevent
potential errors of unprotected calls from calling places.
Change-Id: Ibdd7080774ff686b4fc96d1d2d020564b367b79a
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
VFE as a client should attach to smmu driver only once. Add ref_cnt
to prevent additional attach.
Change-Id: I03e24fe3872661d9ae91645a2f80530134e0069d
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
reverting buffer queue in isp buf manager and
check buffer validity in isp buf mgr as in dual vfe
case number of buffer are more and it is taking
more time which causes RCU stall.
Change-Id: I84dc72edd8834ae2addcc7cc33677b10c61ff177
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
Camera SMMU driver is new implement on kernel 3.14 and kernel
3.10 also needs to have the same camera SMMU driver. During
the merge process of SMMU driver, there are many SMMU driver
changes in kernel 3.14. So to make SMMU driver consistent in
both kernel 3.14 & 3.10, Add those changes from kernel 3.14
to kernel 3.10.
Change-Id: Ie9da3c1e3fc66d49467fbf112719bdb5c9f53e60
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
If the security mode is not passed properly to
the kernel from user space. ISP would detach to
a wrong context bank. Fixing the issue by tracking
the security mode in buffer manager.
Change-Id: I5c5e5ce2a7c2e2b209c45a605093fe3e5495ef8d
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
This change Create device pointer for each context bank
to keep track of mapping information and uses upstream SMMU
APIS to map buffer into SMMU. Also the driver Abstract
all SMMU APIS for all the camera client drivers thus
avoid duplication of code
Change-Id: I80a159ddb2401defeb1479894bc27c78e0b88e68
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
If 2 vfe write different frames to same buffer, it causes split.
Add frame id to buf to detect such errors and trigger recovery in
that case.
Also remove prints from process_error_info() and send the framedrop
info as piggyback in SOF event.
Change-Id: I353bf8c5b5df0dbb2f1e973d53f36e8cb23fb1b6
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
Userspace can call some ioctls with 0 value for bufq_handle which is
currently can bypass checks in msm_isp_get_bufq and will result in
using uninitialized bufq structure, even though 0 is not a legitimate
value for bufq_handle. This change adds a check to prevent this
behaviour and to return error in case it happens.
Change-Id: I6422ec82671080cfa62fc43026b6cc33261cf11c
Signed-off-by: Petar Sivenov <psiven@codeaurora.org>
Adopt generic buff mgr and isp buff mgr to use
VB2_MAX_FRAME to support v4l2 supported maximum
buffers.
Change-Id: I7e15749e429e0a8c2f19428e78aca7587c000313
Signed-off-by: Hariram Purushothaman <hariramp@codeaurora.org>