Commit graph

314139 commits

Author SHA1 Message Date
Johan Mossberg
def8244404 gpu: ion: Add support for sharing buffers with dma buf kernel handles
Currently ion can only share buffers with dma buf fd's. Fd's can not be
used inside the kernel as they are process specific so support for
sharing buffers with dma buf kernel handles is needed to support kernel
only use cases. An example use case could be a GPU driver using ion
that wants to share its output buffers with a 3d party display
controller driver supporting dma buf.

Change-Id: I74388160ad65ee5380b87dbb20521a97ddf6727a
Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
Git-commit: 1a6c74e0d58f6ca028f36c3d794fecff8543bbfb
Git-repo: https://android.googlesource.com/kernel/common
[lauraa@codeaurora.org: update callers of function]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2018-08-27 14:52:38 +00:00
Laura Abbott
d5f76e2f05 gpu: ion: Free the sgtable for CMA based heaps
When an sgtable is allocated with sg_alloc_table, the table needs
to be destroyed in addition to being freed. Destroy the sgtable
when freeing the associated memory.

Change-Id: Iedba81146ba453070790f071848f86826f7eec9c
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
2018-08-27 14:52:38 +00:00
Rahul Sharma
5e597b465b msm: vidc: prevent vcd_stop to wait for long
Video decoder release calls vid_dec_close_client which calls vcd_stop.
If vcd_stop notification fails, then there is a long wait. This patch
is limiting the same

Change-Id: Ibdf33e3882826429bf8c49a5888b8c9908e2e62d
Signed-off-by: Rahul Sharma <sharah@codeaurora.org>
2018-08-27 14:52:38 +00:00
wyun
53010ac515 msm: vidc: Enable dynamic debug level & out for video kernel driver
"level" has an option of FATAL, ERROR, HIGH, MED, LOW.
  >>usage for all levels: adb shell "echo 0xF > /d/vidc/vidc_debug_level"
"out" has an option of printk or trace_printk.
  >>usage for terminal window: adb shell "echo 1 > /d/vidc/vidc_debug_out"

Change-Id: I0ea3ed2999cc80e691ea86667401eff6c1bf88a8
Signed-off-by: wyun@codeaurora.org
2018-08-27 14:52:37 +00:00
Shiju Mathew
1ecc53d36d msm: vidc: Add support for Picture Order Count Type
This patch adds POC type support for video core that
enables low-latency encoding.

Change-Id: I1fe8ea38c7ed8d203a3ef99febb4001165a856fe
Signed-off-by: Shiju Mathew <shijum@codeaurora.org>
2018-08-27 14:52:37 +00:00
c_sridur
e3f2503670 msm_vidc: Frame height is not updating for low resolution clip
Fix: Update frame height preoperly for height lesser than 64

Change-Id: I17cf166a40f77fcea74e7d0c19af801e6e6244d5
Signed-off-by: c_sridur <sridur@codeaurora.org>
2018-08-27 14:52:37 +00:00
Prados Das
a534d63a4c Revert "msm: vidc: No need to allocate metadata by default"
This reverts commit 0efc959be55801808454292cc61d11ff8ab1bfa1

Change-Id: I08163ac9e4d4481cb9df324fd8ccc14bef536d96
Signed-off-by: Prados Das <prados@codeaurora.org>
2018-08-27 14:52:36 +00:00
Deepak Verma
c5aa9f6b0e msm: vidc: No need to allocate metadata by default
If metadata is not enabled by client, there is no need
to enable it by default.

Change-Id: I6d5bd1c04dcdf78549afac57bcaceb82602da270
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:36 +00:00
srikarri
b4cae04f14 msm: vidc: enable pic_order_cnt_type for H264 encoding
-current implementation will result in poc_type as 0 in SPS
params (even though the poc increment value is 2 in the
encoded stream).
-So changes done to return poc_type as 2 in SPS params

Change-Id: I5a22af422b0e1591a69a0b5b868342667ee60bbf
Signed-off-by: srikarri <sridur@codeaurora.org>
2018-08-27 14:52:36 +00:00
Deepak Verma
199e7908cf msm: vidc: Set input buffer size dynamically
This change supports overriding of default input
buffer size using a set parameter call from the
client.

Change-Id: I5225ec53ba16b68aeedd4c30897bd291e81b4b09
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:35 +00:00
Deepak Verma
446bc8aa6e msm: vidc: Initialize kernel space stack variables
This change initializes kernel space stack variables
that are passed between kernel space and user space
using ioctls.
Non initialization of these variables may lead to
leakage of memory values from the kernel stack to
user space.

Change-Id: Icb195470545ee48b55671ac09798610178e833e1
CRs-fixed: 556771,563420
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:35 +00:00
Deepak Verma
889ead1155 msm: vidc: Validate input data before processing
User controlled data needs to be validated before
processing, otherwise it may corrupt existing data
and other programming variables which may further
lead to crash in kernel space.
This change validates user specified buffer's data,
such as offset and data length, before performing
any operations in kernel.

Change-Id: Idb2a5c4c270cdbb55adfc0c22b9296b7dd359de9
CRs-fixed: 547695
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:35 +00:00
srikarri
e08007f901 msm: vidc: free the recon buffers in cleanup function
- The recon buffers were not released when video recording
  was killed abruptly leading to memory leak.

- Fix provided to release the recon buffers when media
  server killed abruptly.

Change-Id: I48ac1a592719446b7e4bf87bbd707d09351d1e61
Signed-off-by: srikarri <sridur@codeaurora.org>
2018-08-27 14:52:34 +00:00
Mayank Chopra
082823053c msm: rotator: Add support to YCBYCR rotator format
Add support for MDP_YCBYCR_H2V1 interleaved YUV format in rotator
block.

Change-Id: I4bb192aaab1e72f6e5687ae222a5f9ea2c254bd4
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
2018-08-27 14:52:34 +00:00
Mayank Chopra
e92f596664 msm_fb: display: Add support to YCBYCR MDP format
Add support of MDP_YCBYCR_H2V1 interleaved YUV format to MDP
for a-family targets.

Change-Id: I5afb84a95693d1ced114152364782a10c4d56bc2
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
2018-08-27 14:52:33 +00:00
Vishnuvardhan Prodduturi
46076762d6 msm: msm_fb: Replace wait for DMA_P with VSYNC in Pan_display Path.
This is a follow up change on gerrit 442946. Wait for DMA_P has to be
replaced with VSYNC even in Pan Display Path.

Change-Id: I8d600022cfa63f54d5b72ea5f64fc55315079b3a
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
2018-08-27 14:52:33 +00:00
Vishnuvardhan Prodduturi
77e93ca69c msm: msm_fb: wait for VSYNC instead of DMA_P for commit completion.
In the current implementation, we are waiting for DMA_P interrupt
in commit call to signal completion. This can cause 2 commits happening
in the same vsync period due to which IOMMU page faults can happen when
vsync comes while second commit is programming resgisters. To avoid this,
wait for DMA_P is replaced by wait for VSYNC.

Change-Id: I68d4d4b4e7a574f86faecd5b4812e1f5852f4209
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
2018-08-27 14:52:33 +00:00
Maheshwar Ajja
3c4ccf282e msm: vidc: Add LTR feature for H264 encoder
This change adds Long Term Reference picture
selection feature for H264 video encoder.

Change-Id: Ida957df244d8715c955afe8d809708123a94e999
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:32 +00:00
Olav Haugan
43040691a3 iommu: msm: Handle unmapping of PTE properly
The unmap api is currently not handling unmapping of page table
entries (PTE) properly. The generic function that calls the msm
unmap API expects the unmap call to unmap as much as possible
and then return the amount that was unmapped.
In addition the unmap function does not support an arbitrary input
length. However, the function that calls the msm unmap function
assumes that this is supported.

Both these issues can cause mappings to not be unmapped which will
cause subsequent mappings to fail because the mapping already exists.

Change-Id: I638d5c38673abe297a701de9b7209c962564e1f1
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2018-08-27 14:52:32 +00:00
Jeremy Gebben
9dac5e5da3 iommu: msm: prevent partial mappings on error
If msm_iommu_map_range() fails mid way through the va
range with an error, clean up the PTEs that have already
been created so they are not leaked.

Change-Id: Ie929343cd6e36cade7b2cc9b4b4408c3453e6b5f
CRs-Fixed: 478304
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2018-08-27 14:52:31 +00:00
Laura Abbott
69cd952800 iommu: msm: Don't treat address 0 as an error case
Currently, the iommu page table code treats a scattergather
list with physical address 0 as an error. This may not be
correct in all cases. Physical address 0 is a valid part
of the system and may be used for valid page allocations.
Nothing else in the system checks for physical address 0
for error so don't treat it as an error.

Change-Id: Ie9f0dae9dace4fff3b1c3449bc89c3afdd2e63a0
CRs-Fixed: 478304
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2018-08-27 14:52:31 +00:00
Jeremy Gebben
6b44ed1956 iommu: msm: check range before mapping for IOMMU-v1
Make sure iommu_map_range() does not leave a partial
mapping on error if part of the range is already mapped.

Change-Id: I108b45ce8935b73ecb65f375930fe5e00b8d91eb
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2018-08-27 14:52:31 +00:00
Olav Haugan
962d00eb87 iommu: msm: Use phys_addr_t for physical addresses
IOMMU map and unmap function should be using phys_addr_t
instead of unsigned int which will not work properly with
LPAE.

Change-Id: I22b31b4f13a27c0280b0d88643a8a30d019e6e90
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2018-08-27 14:52:30 +00:00
Kevin Matlage
77a8b4b9d1 iommu: msm: Let IOMMUv1 use all possible page sizes
Allow the IOMMUv1 to use 16M, 1M, 64K or 4K iommu
pages when physical and virtual addresses are
appropriately aligned. This can reduce TLB misses
when large buffers are mapped.

Change-Id: Iffcaa04097fc3877962f3954d73a6ba448dca20b
Signed-off-by: Kevin Matlage <kmatlage@codeaurora.org>
2018-08-27 14:52:30 +00:00
Mitchel Humpherys
0423b88e29 msm: iommu: re-use existing buffers for `extra' mappings
There is a bug on some hardware that requires us to overmap Iommu
mappings by 2x. Currently, we set aside a dummy buffer onto which we
map all of these dummy mappings. In general, for large mappings it's
nice to use the more efficient iommu_map_range instead of calling
iommu_map repeatedly. However, with our current approach in
msm_iommu_map_extra we can't use iommu_map_range for page_sizes larger
than the dummy buffer. To avoid wasting memory by increasing the size
of the dummy buffer, we can simply remap on top of the the buffer
being mapped in the first place. Since the second mapping should never
be used (besides by the buggy hardware) this should not be a problem.

Re-use existing buffers for all `extra' mappings. Essentially, map the
same physical address range twice. To be extra safe, make the second
mapping read-only.

Change-Id: I35462ad50de8da1f2befa3e3f0895925535cdc98
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
2018-08-27 14:52:30 +00:00
Chintan Pandya
32c723c2da ion: cma: Add debug heap ops for CMA heap
For tracking CMA allocation by address and fragmentation
(if any), add debug heap ops which gives buffer allocation
info.

Change-Id: Ia8bed38034b85b2d4dcf84811a348bbbe50dc16b
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
2018-08-27 14:52:29 +00:00
Padmanabhan Komanduru
b3bd3f5e9e msm: rotator: Extend fast YUV invalid checker for 2-pass
For 2-pass mode, we need to check for the fast YUV constraints
separately for both the 1st and 2nd pass. Make change to extend
the fast YUV invalid checker to 2-pass mode.

CRs-fixed: 504007
Change-Id: I7ef96ff29423fbd5cc454e8fd125b4bb1a9d59e1
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:29 +00:00
Padmanabhan Komanduru
58d0be7cee msm: rotator: Pass ION flags correctly for 2-pass buffer allocation
With updated ION interface, ION_SECURE needs to be passed as a
separate flag. Also, 2-pass buffer for secure session needs to be
allocated from CP heap instead of non-secure heap.

CRs-fixed: 502038
Change-Id: I8c5f945dc4d90ce640872e2cd0505ac32e82011d
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:29 +00:00
Padmanabhan Komanduru
3176776cf1 msm: rotator: Enable support for 2-pass fast YUV mode
Add support for 2-pass rotator operation for downscaling
and 90 degree rotation when rotator operates in fast YUV
mode. 2-pass is supported for 420 H2V2 formats.

Change-Id: Ib8ce802a5a8aabe10c88422e3b8d82708c5b05d4
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:28 +00:00
Maheshwar Ajja
50f8458679 msm: vidc: Memset and flush codec context buffers
This change will memset and flush the codec context
buffers for non-secure case to resolve video driver
timer expire issues.

Change-Id: I6669481da3076a392061868475fc9844f2c41064
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:28 +00:00
Mayank Chopra
31456ea019 msm_fb: display: Fix interleaved 422 input format register settings
Check to update chroma sample information in source format register is
based on fetch plane value, which does not take into account for
interleaved 422 input format. Remove this check and set chroma sample
values for RGB formats as well.

CRs-Fixed: 501035
Change-Id: If8fd47b6d47b326efd1cb70ce9701ac1d457dcfd
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:27 +00:00
Mayank Goyal
60e928abe0 msm: rotator: Add pseudo-planar 422 H1V2 dst format for MDP4
Rotator outputs pseudo-planar 422 H1V2 for interleaved inputs
on 90 degree rotation.Add changes to support MDP_Y_CRCB_H1V2,
MDP_Y_CBCR_H1V2 in MDP4.

CRs-Fixed: 371303
Change-Id: I42ea86992fc77cd335437a47611e9f640f30ed25
Signed-off-by: Mayank Goyal <goyalm@codeaurora.org>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:27 +00:00
Mayank Chopra
4cbef40a63 msm_fb: display: Add pseudo-planar 422 H1V2 support in the MDP4
Rotator outputs pseudo-planar 422 H1V2 for interleaved inputs
on 90 degree rotation. Add changes to support MDP_Y_CRCB_H1V2
in MDP4.

CRs-Fixed: 371303
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay.c

Change-Id: I730a3196df8d0c204e6334c2c8b9199d15cbb16a
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
2018-08-27 14:52:27 +00:00
Olav Haugan
b2f336f001 gpu: ion: Do fallback when allocating large sizes
The preferred allocation of memory for kernel data structures in
ION is to use kmalloc. This is mainly for performance reasons. However,
we are not guaranteed to be able to allocate large sizes. So to keep
the code performing well and at the same time allow for larger allocations,
implement a fallback mechanism for allocation of memory for ION kernel data
structures.

CRs-Fixed: 488521
Change-Id: I8c6a13ad74cce69f590920d28c01a58f7a540fd2
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[Resolved merge conflict]
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
2018-08-27 14:52:26 +00:00
Olav Haugan
8c4fa43875 gpu: ion: Use correct type for variables
Use correct type for variables to prevent overflow of signed
type when assiging from an unsigned type.

Change-Id: I0055d35c7310d111de590db3798950fd98f1b298
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2018-08-27 14:52:26 +00:00
Mitchel Humpherys
fe14bcb98f gpu: ion: enable the kmalloc heap
There are some Ion clients who would like to use the kmalloc
heap. Enable it.

Change-Id: Ie818be9e1211d52d489ad2cb63d94e2fddfc0f01
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
2018-08-27 14:52:26 +00:00
Olav Haugan
b09506ba9f gpu: ion: Align va address to biggest buffer size
Align the virtual address to the max buffer size to
allow IOMMU mappings at the biggest buffer size.

Change-Id: I74ba665c1782e2f0631274766c5caeeb192224e0
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2018-08-27 14:52:25 +00:00
Maheshwar Ajja
1f9b4f459a msm: vidc: Amend error check conditions on ION APIs
Amend error check conditions appropriately to return
properly from video applications in case of ION API
failures.

Change-Id: Ibe95a8438a66e88b35dbff0af8842ff4b038c5e1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:25 +00:00
Maheshwar Ajja
6a9440707a msm: vidc: Get the current performance level
This change supports client to get the current
performance level of the video driver via
IOCTL_GET_PERF_LEVEL. The current performance
level indicate the number of MBs per second
is being processed by video hardware.

Change-Id: Ic6f5b2b14e0d77bf801c4f857f8a0e20339c199f
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:25 +00:00
Maheshwar Ajja
fc9cab72cb msm: vidc: Handle mgen2maxi interrupt in video driver
Handle interrupt generated by mgen2maxi h/w and
avoid unknown interrupts storm which results in
target reset issues.

Change-Id: Ida24cb2dde15c9cd4a4c1d9ca336b1a4b662c4d1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
2018-08-27 14:52:24 +00:00
Maheshwar Ajja
f675bfaac7 msm: vidc: Allow client to set turbo mode
- Allow client to set TURBO performance level
  to video driver.
- Update max performance level to TURBO perf level
  on supported targets.

Change-Id: I0b3b38140d777984ba5062ddd614c07a002389ba
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
2018-08-27 14:52:24 +00:00
Maheshwar Ajja
f897cdbb4f msm: vidc: Remove unncessary unmap function calls
Calling unncessary unmap function resulting in
target reset. This change resolves the issue by
removing unncessary unmap functions in video driver.

Change-Id: I0b501f0a7115bba085b067a5e78172df210da8f1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
2018-08-27 14:52:24 +00:00
Maheshwar Ajja
d9108943e8 msm: vidc: Optimize IOMMU map size for H264 decoder
IOMMU map size is not required to be double the actual
buffer size for H264 decoder. So reducing IOMMU map
size for H264 format which will enable support for
two H264 decoder instances in parallel in smooth streamig
mode where the number of output buffers equal to 18 with
each buffer size equal to 1080p buffer size.

CRs-fixed: 491718
Change-Id: Ie6782b2ff58667000213f25482eea151b849762b
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:23 +00:00
Srinu Gorle
0460f7ed8a msm: vidc: Remove unwanted error message
This change removes unwanted error message about video
clock settings.

Change-Id: I49f30d681366e07a2e002a9df58460962fd12318
CRs-Fixed: 488058
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:23 +00:00
Deepak Verma
906f07db65 msm: vidc: Set extradata flag properly
Extradata flag is not set to output buffer header's flag in
case when a Mpeg2 clip is played and extenstion and user data
extradata is not enabled.
This change fixes the issue and set extradata flag properly
if extradata is enabled and extradata is available with the
the buffer.

CRs-fixed: 490067
Change-Id: I029dadb17d98dd37388eee34f51bd0dfaf56d14a
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
2018-08-27 14:52:22 +00:00
Srinu Gorle
0497ffd266 msm: vidc: Do not reset VCD_FRAME_FLAG_DATACORRUPT flag for VC1
- To propagate VCD_FRAME_FLAG_DATACORRUPT flag to IL client, dont reset.

Change-Id: I68bf4c953c02a2a4327fe6e875863853cb4e0bf8
CRs-Fixed: 472798
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
2018-08-27 14:52:22 +00:00
Shobhit Pandey
687aa8293f msm: vidc: Fix compilation errors
This change removes the compilation error in kernel
if ddl logs are enabled.

CRs-Fixed: 483776
Change-Id: Iffc37fcdd4e5ce7ddcd8560d432af5c3f3e6c433
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
2018-08-27 14:52:22 +00:00
Maheshwar Ajja
4dec300645 msm: vidc: Update sub_anchor_mv buffer size
The sub_anchor_mv size is not sufficient if the height
is more than 1088 in video clips, this change will amend
the buffer size to avoid video hardware resulting iommu
crash failures for such clips.

Change-Id: Ie59f04b9edaa9d2364d4e5014d2eb6f882728c76
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:21 +00:00
Shobhit Pandey
6079d5980d msm: vidc: Correct log tagging for kernel messages
This change amends the log tagging in kernel.

CRs-fixed: 478607
Change-Id: I2c7056d8fc9ec82ffbc6824790c064033481a9af
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
2018-08-27 14:52:21 +00:00
Maheshwar Ajja
37560cd750 msm: vidc: Free buffer pool entry and then delete address table
Free the buffer pool entry first and then delete the
address table (which will unmap the buffer with iommu)
else we might get a corner case where the entry was not
freed but the buffer is unmapped and the next buffer is
mapped with the same physical address which is still
available in the buffer pool entry, which results in
video recording failure.

Change-Id: I6978d5e5de35db63f43a7f38c58940216217b676
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2018-08-27 14:52:21 +00:00