GitHub/LineageOS/android_kernel_motorola_exynos9610.git
6 months agodma-buf: introduce dma-buf container
Cho KyongHo [Fri, 13 Apr 2018 04:52:11 +0000 (13:52 +0900)]
dma-buf: introduce dma-buf container

dma-buf container is a dma-buf that can contain multiple other dma-buf
objects. It is developed to deliver many dma-buf objects with a single
inter-process or user-kernel commnunication.

Change-Id: I2a13e0c0644f350fb4805120ee5900f101cd2c18
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agomm/hpa: add alloc_pages_highorder_except()
Cho KyongHo [Thu, 3 May 2018 08:09:42 +0000 (17:09 +0900)]
mm/hpa: add alloc_pages_highorder_except()

alloc_pages_highorder() allocates given number of pages of given order.
It is a page allocator with a restriction of page order. Therefore, it
is used by the drivers of H/Ws with a requirement of higher memory
alignment than PAGE_SIZE.
Moreover some H/W have additional restriction of memory addressing.
They are not accessible to some range of memory.
alloc_pages_highorder_except() provides a way to avoid unaccessible
memory area to HPA not to allocate inappropriate pages to the drivers.

Change-Id: I6c5fe40c7dd5367ea15eb69c7bf68325070dafa4
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[9610] fbdev: dpu20: updated panel backlight driver
ChiHun Won [Tue, 29 May 2018 02:01:31 +0000 (11:01 +0900)]
[9610] fbdev: dpu20: updated panel backlight driver

Change-Id: I4d48dd221a538f6f51a931fa810945b0e738b924
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agoRevert "[9610] fbdev: dpu20: fixed decon reg update timeout"
ChiHun Won [Mon, 28 May 2018 12:17:49 +0000 (21:17 +0900)]
Revert "[9610] fbdev: dpu20: fixed decon reg update timeout"

reviewed

This reverts commit dcd6df9d93ce7f50c9171473541d5e71aa62366e.

Change-Id: Ic61af2126e43f4607a902614f92e81bff9c3adcb
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] fbdev: dpu20: updated dpp dma debug sfr
ChiHun Won [Mon, 28 May 2018 12:08:04 +0000 (21:08 +0900)]
[9610] fbdev: dpu20: updated dpp dma debug sfr

Change-Id: If68791ca39c60ab0ab2ea68aba8d19c609143209
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] arm64: config: enabled paritial window update
ChiHun Won [Sat, 26 May 2018 01:22:32 +0000 (10:22 +0900)]
[9610] arm64: config: enabled paritial window update

Change-Id: I0ba4f99e3a2a5f610c5cb36b1c70fec81dffa683
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] arm64: config: enabled hibernation mode
ChiHun Won [Sat, 26 May 2018 01:09:00 +0000 (10:09 +0900)]
[9610] arm64: config: enabled hibernation mode

Change-Id: I80cea43618f6506dcf5e2c6af5efae8a3af528b3
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] arm64: dts: updated dpu device tree
ChiHun Won [Sat, 26 May 2018 01:08:37 +0000 (10:08 +0900)]
[9610] arm64: dts: updated dpu device tree

Change-Id: I8366770fa3fd37473b377ea1968c7a106825bf66
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: power domain status check
ChiHun Won [Sat, 26 May 2018 00:35:15 +0000 (09:35 +0900)]
fbdev: dpu20: power domain status check

reviewed

Change-Id: Ic95e7c4a9b3b511a0feaa54cf2afaccc323af3e1
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: added acquire fence logging
ChiHun Won [Fri, 25 May 2018 22:34:36 +0000 (07:34 +0900)]
fbdev: dpu20: added acquire fence logging

reviewed

Change-Id: Ib8f0e6dd3001afc84bc1ac36ab1e1f41826f6b0c
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: fixed decon init display DMA2CH mapping error
ChiHun Won [Fri, 25 May 2018 08:04:42 +0000 (17:04 +0900)]
fbdev: dpu20: fixed decon init display DMA2CH mapping error

reviewed

Change-Id: I963d349427a2a0b8366cccd9ff6d176f91efb56c
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: added missing shadow update code
ChiHun Won [Fri, 25 May 2018 07:59:31 +0000 (16:59 +0900)]
fbdev: dpu20: added missing shadow update code

reviwed

Change-Id: Idb3241089d1628300a149d2eabe73db2e491c3b8
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] fbdev: dpu20: changed decon window shadow update
ChiHun Won [Fri, 25 May 2018 07:44:35 +0000 (16:44 +0900)]
[9610] fbdev: dpu20: changed decon window shadow update

Change-Id: I1330abe6e8b42e3d9bb8e8c380d7ac438180d6e3
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: fixed decon pan display DMA2CH mapping error
ChiHun Won [Fri, 25 May 2018 07:40:33 +0000 (16:40 +0900)]
fbdev: dpu20: fixed decon pan display DMA2CH mapping error

Change-Id: I6c176d68c6104f1ac9cfa237223088e2d519698d
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: removed unnecessary sysreg read
ChiHun Won [Fri, 25 May 2018 07:37:25 +0000 (16:37 +0900)]
fbdev: dpu20: removed unnecessary sysreg read

Change-Id: I6284be05332f02fc092e4a1854360062cc7a8a6a
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] fbdev: dpu20: cal9610: changed dsim dphy reset
ChiHun Won [Sat, 19 May 2018 02:31:59 +0000 (11:31 +0900)]
[9610] fbdev: dpu20: cal9610: changed dsim dphy reset

Change-Id: Ib1059982c8ca70a6ff574fd79497b6cca77e2f99
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agoRevert "[9610] fbdev: dpu: dphy reset method is changed by sysreg control"
ChiHun Won [Fri, 25 May 2018 02:21:45 +0000 (11:21 +0900)]
Revert "[9610] fbdev: dpu: dphy reset method is changed by sysreg control"

This reverts commit 8abbf947e6187cf8338b45fd9ad014b00d7f3ebd.

Change-Id: Idde3cf7176a1c14ca22d4689dc10b4efad07e71f
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months agofbdev: dpu20: blocking mode set condition is modified
hwangjae lee [Fri, 25 May 2018 05:26:45 +0000 (14:26 +0900)]
fbdev: dpu20: blocking mode set condition is modified

In the past, it was possible to set a blocking area in a bottom window
if the top window plane alpha value was 0. In this case, the top window
becomes transparent, and the blocking area of the window looks black.
 So it is modified that when the top window plane alpha value was zero,
blocking area isn't set in the bottom window.

Change-Id: I2340369331082c939f4d7013c002452affd836bc
Signed-off-by: hwangjae lee <hj-yo.lee@samsung.com>
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
6 months ago[9610] arm64: defconfig: enable smfc
Seungchul Kim [Mon, 28 May 2018 04:59:41 +0000 (13:59 +0900)]
[9610] arm64: defconfig: enable smfc

Change-Id: Iae0b15e4bd84f6cec44a9e680488ffab695a2019
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
6 months ago[9610] arm64: dtsi: add smfc node
Seungchul Kim [Mon, 28 May 2018 04:58:43 +0000 (13:58 +0900)]
[9610] arm64: dtsi: add smfc node

Change-Id: Iecc579cc0fc712b88b3ee48887bc8c3aafa427bb
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
6 months ago[COMMON] media: smfc: fix security problem
Seungchul Kim [Fri, 23 Mar 2018 08:00:40 +0000 (17:00 +0900)]
[COMMON] media: smfc: fix security problem

The security problem has been reported in smfc driver.
If user sends a special ioctl command,
smfc driver can cause a kernel panic.
So it is modified to avoid kernel panic.

Change-Id: I7b5c4e295e8190cf0fb50d3c4b951a74470101ad
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
6 months agomedia: smfc: set dma mask of 36-bit
Cho KyongHo [Wed, 21 Feb 2018 01:58:50 +0000 (10:58 +0900)]
media: smfc: set dma mask of 36-bit

SMFC driver needs to configure dma mask of 36-bit not to force
allocation of swiotlb buffers during dma-mapping.

Change-Id: I2cb2637462703d4c113f855b95bef4cafffd79ff
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix prevent issue
Seungchul Kim [Fri, 24 Nov 2017 06:02:51 +0000 (15:02 +0900)]
[COMMON] media: smfc: fix prevent issue

This patch fixed below prevent issue about other violation types.

CID 201997, 201944, 200890, 200853

Change-Id: Icf94074d36c7d4526e13e25c9dc188875dabec77
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
6 months ago[COMMON] media: smfc: compare the conditions clearly
Cho KyongHo [Tue, 27 Dec 2016 11:29:11 +0000 (20:29 +0900)]
[COMMON] media: smfc: compare the conditions clearly

The recent versions of the compilers(e.g. GCC 5.3) warn that a unary
operator may be used without a care. Therefore, we should wrap the
operator and its operands with parenthesis to show clear precedence.

Change-Id: Ibc7e758dd67e62182a120bc705a561586a521c70
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: force non-shareable read
Cho KyongHo [Tue, 3 Jan 2017 16:21:35 +0000 (01:21 +0900)]
[COMMON] media: smfc: force non-shareable read

SMFC/JPEG is connected with MCSC by HWFC. Therefore write DMA of MCSC
and the read DMA of SMFC should be in the same shareability domain.
However MCSC is always in non-shareable domain by Exynos8895 and SMFC
is in inner-shareable domain in Exynos8895. Due to HWFC, SMFC should
not wait until MCSC driver to invalidate cache lines when MCSC
finishes DMA write because SMFC starts reading as soon as MCSC starts
writing.
Therefore, the read DMA of SMFC should be non-shareable and cache
maintenance operations do not effect if HWFC is enabled.

Change-Id: I8e5d7878b0b2f6e35a33903b0683b45a6dcd7514
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix missing vertical subasampling check
Cho KyongHo [Thu, 5 Jan 2017 13:40:30 +0000 (22:40 +0900)]
[COMMON] media: smfc: fix missing vertical subasampling check

HWJPEG is unable to handle YUV410. Therefore, the driver should check
if both of the horizontal and vertical chroma subsampling factor is 4.
However, the driver checked horizontal factor instead of vertical
factor.

SVACE WGID 2521

Change-Id: I187ff5e4d0c3ff9cf1efdd97b86b7e09c4754af0
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: deactivate sysmmu for scaler
Won Jung [Mon, 24 Oct 2016 05:18:15 +0000 (14:18 +0900)]
[COMMON] media: smfc: deactivate sysmmu for scaler

sysmmu is deactivated to prevent sfr access by sysMMU,
after smfc power domain is turned off.

Change-Id: I19e6dc9504a78cb88d705c6ba07f3889e4570516
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: smfc: add the shutdown callback
Won Jung [Thu, 22 Sep 2016 07:48:03 +0000 (16:48 +0900)]
[COMMON] media: smfc: add the shutdown callback

if shutdown, smfc driver should wait to finish the H/W
operation to avoid the access the power domain/ clk
after the detach of pm_domain

Change-Id: I7328be4c4c4ef15ba578c5c44e3ba5396592fcce
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[8895] media: smfc: add sync mode for hwfc
Won Jung [Wed, 1 Jun 2016 06:48:09 +0000 (15:48 +0900)]
[8895] media: smfc: add sync mode for hwfc

add sync mode for hwfc. This mode is to inform camera
that hwjpeg compression is done in HWFC mode.

Change-Id: I7cdf276069b3ffb83a342aeb50f338bdf9d7c5ae
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[8895] media: smfc: add cropping window
Won Jung [Wed, 25 Nov 2015 08:04:05 +0000 (17:04 +0900)]
[8895] media: smfc: add cropping window

cropping window feature is added for encoding
and inefficient codes are removed

Change-Id: I975b57199124ed5c32b6030e2b4d9314fba9653f
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: smfc: add support for custom quantization tables
Cho KyongHo [Mon, 5 Oct 2015 16:08:22 +0000 (01:08 +0900)]
[COMMON] media: smfc: add support for custom quantization tables

Some users needs to configure their own quantization tables instead of
the quality factors that is the factor to calculate the quantization
tables based on the ones suggested by ITU-81 Appendix K.1 and K.2.

Now the driver supports for the new custom control variable,
V4L2_CID_JPEG_QTABLES2 that is an array of V4L2_CTRL_TYPE_U8 with
128 values (two arrays with 64 elements). One of the table is for
the quantization table of the Luma and the other table is for the
chroma components. The values in the quantization tables should be
specified in the zig-zag scan order.

Note that once the custom quantization tables are configured, it is
used for the compressions until a new quality factor or a new
quantization is configured.
Also note that the custom quantization tables are configured to H/W
even though the table stored in the v4l2_ctrl is in transient state.
Therefore, configuring new custom quantization tables with s_ctrl or
s_ext_ctrl during the H/W is working for the current context may cause
an unpredictable result which means the quantization tables that is
used by the H/W may be incorrect and it impacts the compression
quality of the compressed stream.

Change-Id: Ifa8e346e188b118c480e576676de8c6a46e1468d
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix bugs reported by Coverity
Cho KyongHo [Tue, 29 Sep 2015 11:42:47 +0000 (20:42 +0900)]
[COMMON] media: smfc: fix bugs reported by Coverity

This patch includes the fixes for CID 187514, CID187540 and 187531.

Change-Id: I225fa93071e0e57f1e58825961d74cd6b315578e
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix resource leak in exynos_smfc_release()
Cho KyongHo [Sat, 19 Sep 2015 11:14:35 +0000 (20:14 +0900)]
[COMMON] media: smfc: fix resource leak in exynos_smfc_release()

SMFC driver overrides V4L2 control handlers when a new context is
created but it forgot to release the overridden handlers when the
context is released.

Change-Id: Id241dd029618d3eca7c37da28f8075e5e6a49360
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add support for HWJPEG compatible with Exynos7870
Cho KyongHo [Fri, 11 Sep 2015 02:00:57 +0000 (11:00 +0900)]
[COMMON] media: smfc: add support for HWJPEG compatible with Exynos7870

The HWJPEG of Exynos7870 is equivalent to the HWJPEG of Exynos8890 but
HWFC. Therefore, it is required to distinguish them.

Change-Id: Ic4b82c2c0d1c4521d3adbf245ba71c2a67d45fd4
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: remove REG_MAIN_MAX_STREAM_SIZE register
Cho KyongHo [Tue, 15 Sep 2015 01:40:19 +0000 (10:40 +0900)]
[COMMON] media: smfc: remove REG_MAIN_MAX_STREAM_SIZE register

It now no longer exists and was for lossless JPEG compression that
was an experimental feature of SMFC. But lossless JPEG compression
is not supported by SMFC in public.

Change-Id: I7c0c2e32b9ea5a37e510d99c9df7af70b3df624e
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: invalid the cache lines as little as possible
Cho KyongHo [Mon, 14 Sep 2015 15:53:57 +0000 (00:53 +0900)]
[COMMON] media: smfc: invalid the cache lines as little as possible

The amount of data to invalidate CPU cache lines of the destination
buffer of the JPEG compression is much smaller than the length of
the destination buffer because the userspace tends to qbuf the buffer
that is large enough to store the uncompressed image.
Therefore, the data amount of invaidation on the destination buffer
needs to be less than the buffer size for less delay in cache
invalidation and vb2_ion_buf_finish_exact() is for that purpose.

Change-Id: Ifc069a3e940f4e470a2947dc249704340cbe5abb
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix section mismatch
Cho KyongHo [Tue, 18 Aug 2015 16:07:22 +0000 (01:07 +0900)]
[COMMON] media: smfc: fix section mismatch

This fixes the following section mismatch problem:

WARNING: drivers/media/platform/exynos/built-in.o(.text+0x2c96c):
Section mismatch in reference from the function
exynos_smfc_probe() to the variable .init.rodata:exynos_smfc_match
The function exynos_smfc_probe() references the variable
__initconst exynos_smfc_match. This is often because
exynos_smfc_probe lacks a __initconst annotation or the annotation
of exynos_smfc_match is wrong.

Change-Id: Id3498e6d5ff70ce8bc96bb22250776a46092b382
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: change default JPEG version to exynos3475
Cho KyongHo [Mon, 10 Aug 2015 07:50:46 +0000 (16:50 +0900)]
[COMMON] media: smfc: change default JPEG version to exynos3475

FIMP JPEG H/W of Exynos3475 has the minimum functionality. Therefore
it is selected as the default H/W version if the dts does not specify
exact SoC name.

Change-Id: I43060be2ed860ef7dd0f2985b51d3528ffadcf9a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] exynos: smfc: add support for the same H/W of different versions
Cho KyongHo [Wed, 29 Jul 2015 12:13:17 +0000 (21:13 +0900)]
[COMMON] exynos: smfc: add support for the same H/W of different versions

SMFC that is also known as FIMP-JPEG has various H/W versions with
different capabilities. The HWJPEG of Exynos7420 is capable of
downscaling and cropping during decompression while that of Exynos8890
is not. HWJPEG of Exynos3450 does not have the decompression fuction.
Exynos8890, on the other hand, has the advanced functions such as the
hardware flow control(HWFC) and back-to-back compression.

The various version information is distinguished by different
compatible string and the detailed information about each version is
stored in the data field of of_device_id. The driver then uses the
version information in .probe().

Change-Id: Idd847a48167cdef872f7c770dd29d1d441a77eef
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add support for JPEG decompression
Cho KyongHo [Fri, 8 May 2015 02:28:33 +0000 (11:28 +0900)]
[COMMON] media: smfc: add support for JPEG decompression

HWJPEG is capable of decompression of baseline, sequaltial DCT, Huffman
coded JPEG streams to an arbitrary image format that is supported by
HWJPEG. HWJPEG requires the address of SOS marker to start
decompression. Thus the driver should configure quantization tables,
Huffman tables and chroma subsampling factors to HWJPEG separately with
the JPEG stream address (address of SOS marker).
It is convenient to parse a JPEG header in userspace. But the driver
require the address of SOI marker to parse JPEG headers in the driver
because the driver does not convice the userspace to provide correct
information for decompression. Moreover, V4L2 does not consider about
JPEG decompression. It does not provide interface for passing Huffman
tables and quantization tables to the driver from userspace.

JPEG stream can be simply decompressed by passing the address of SOI.
If the given JPEG stream has error or is not supported, the userspace
will get an error from the driver.

Change-Id: I92ea5a1dc91e29bc4588fba8545bf8def0da0cb8
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: change a function name to smfc_v4l2_prepare_s_fmt
Cho KyongHo [Fri, 8 May 2015 02:07:40 +0000 (11:07 +0900)]
[COMMON] media: smfc: change a function name to smfc_v4l2_prepare_s_fmt

smfc_v4l2_check_s_fmt() actually configures type for the current
vb2_queue and JPEG operation mode. 'check' in the function name
does not imply the function changes something.

Change-Id: I778a7d83f217224160a6fd4c34c20ffdfc15fb12
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: move v4l2 ioctl handlers in separate file
Cho KyongHo [Thu, 23 Jul 2015 08:07:25 +0000 (17:07 +0900)]
[COMMON] media: smfc: move v4l2 ioctl handlers in separate file

The implementation of v4l2 ioctl handlers occupies the half of smfc.c
The handlers are moved to another file for easier maintenance.

Change-Id: Ic65243aef0e173177f819be9b723bdea36c81ba9
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: use s/w timer if HWFC is enabled
Cho KyongHo [Wed, 22 Jul 2015 14:42:02 +0000 (23:42 +0900)]
[COMMON] media: smfc: use s/w timer if HWFC is enabled

If HWFC is enabled, the internal timer in the H/W is not available
because when the H/W finishes depends on the outside of SMFC itself.
Instead of the internal timer, S/W timer is used for the case of HWFC.
S/W timer is expired if the H/W is not completed in a second that is
quite huge amount of time.

Change-Id: I0a23448033b91bcb64523cebfeeee14d78c0f410
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: clean the dirty region by CPU in .buf_cleaup
Cho KyongHo [Wed, 22 Jul 2015 08:04:12 +0000 (17:04 +0900)]
[COMMON] media: smfc: clean the dirty region by CPU in .buf_cleaup

Even though userspace gives V4L2_BUF_FLAG_NO_CACHE_CLEAN flag in
the v4l2_buffer on qbuf, it just guarantees that the buffer after
the specific offset is not cache dirty by CPU.
If the offset become smaller than the previous, H/W may starts to
write the compressed stream on the area that may have dirty cache
lines.
To prevent the problem, the driver should clean the dirty cache lines
if the offset becomes no longer valied.

Change-Id: I54baba493dd4c179eda740bedba3378d4abe8435
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: disable timeout interrupt during HWFC is on
Cho KyongHo [Wed, 15 Jul 2015 05:08:01 +0000 (14:08 +0900)]
[COMMON] media: smfc: disable timeout interrupt during HWFC is on

If HWFC is enabled, MC Scaler that generates the source image of SMFC
may starts significantly later than SMFC. We have observed that SMFC
asserts timeout if MC Scalert starts working in the mean time. To
prevent unexpected timeout interrupt, it is reqruied to disable the
timeout interrupt.
Instead of timeout interrupt, hurry threashold interrupt should be
used to detect a problem during compression.

Change-Id: I92d3bf5bfcceb7f757a8600d3623da4127e1519c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix missing secondary interrupt status
Cho KyongHo [Wed, 15 Jul 2015 05:02:38 +0000 (14:02 +0900)]
[COMMON] media: smfc: fix missing secondary interrupt status

SMFC can asserts without no status indication bit of the main image set
if the secondary image causes the interrupt.
Therefor the driver should check the interrupt status of the secondary
image when the interrupt is occurred even though 0 is read from the
interrupt status register of the main image.

Change-Id: I9581213730c88a0f51f414aa29c84f08ed3783c2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix incorrect image format check for HWFC
Cho KyongHo [Wed, 15 Jul 2015 05:04:55 +0000 (14:04 +0900)]
[COMMON] media: smfc: fix incorrect image format check for HWFC

HWFC requires the source image is YUV422 1 plane or YUV420 2 plane.

Change-Id: I5dfeb95cd66a2e9ce5d7cb353a2b249fc469a825
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: do not chroma subsampling for thumbnail with HWFC
Cho KyongHo [Wed, 15 Jul 2015 04:46:48 +0000 (13:46 +0900)]
[COMMON] media: smfc: do not chroma subsampling for thumbnail with HWFC

If Hardware Flow Control is enabled, we have observed that the SMFC
asserts the invalid thumbnail encoding configuration interrupt if the
chroma subsampling factor of the thumbnail JPEG stream is different
from the one of the main JPEG stream.

Change-Id: Ia003859ab08c89f2df3867da36789be476a84b26
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix missing buffer length for RGB32 formats
Cho KyongHo [Wed, 1 Jul 2015 06:57:59 +0000 (15:57 +0900)]
[COMMON] media: smfc: fix missing buffer length for RGB32 formats

Change-Id: Ic2b20937eaa19b79f1264c86c9a46bb662e99714
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix unexpected warning during .stop_streaming
Cho KyongHo [Wed, 1 Jul 2015 06:22:23 +0000 (15:22 +0900)]
[COMMON] media: smfc: fix unexpected warning during .stop_streaming

Videobuf2 asserts warning when vb2_buffer_done() is called for non
active buffers. .stop_streaming() in the driver also has a problem
because it should cancel the queued buffers rather than canceling
all buffers.

Change-Id: I9041c34f6810d8e8aeeffd6b890db226dc2ef640
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: replace v4l2 and vb2 ops with default ones
Cho KyongHo [Wed, 1 Jul 2015 02:58:35 +0000 (11:58 +0900)]
[COMMON] media: smfc: replace v4l2 and vb2 ops with default ones

videobuf2 provides the default logic that is to be done in
.wait_prepare() and .wait_finish().
v4l2_mem2mem provides the default logic of stream API.

Change-Id: I15916a9834a164073dded387e2cd38f1fa8d22bf
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: measure H/W delay
Cho KyongHo [Tue, 2 Jun 2015 07:27:54 +0000 (16:27 +0900)]
[COMMON] media: smfc: measure H/W delay

The delay in usec. is stored to reserved2 field of v4l2_buffer of
capture queue.

Change-Id: I91165095d69003d67c48a36a147d03a386d9ed89
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: initialize all formats with chroma subsampling factor 1
Cho KyongHo [Mon, 18 May 2015 15:01:02 +0000 (00:01 +0900)]
[COMMON] media: smfc: initialize all formats with chroma subsampling factor 1

Otherwise, size check will fail due to zero factor.

Change-Id: I56baa4a36b1fc9f5b7e22f8237aa506358a68bb2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: dump SFR when unexpected IRQ invoked
Cho KyongHo [Mon, 18 May 2015 10:32:57 +0000 (19:32 +0900)]
[COMMON] media: smfc: dump SFR when unexpected IRQ invoked

Dumping SFR helps to debug unexpected IRQ.

Change-Id: I58aa822c127b8087beee5c521445a8f67e18db76
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: clear JPEG codec state after IRQ
Cho KyongHo [Mon, 18 May 2015 10:30:29 +0000 (19:30 +0900)]
[COMMON] media: smfc: clear JPEG codec state after IRQ

It is guided that MAIN_JPEG_CNTL[1:0] should be cleared after IRQ is
handled.

Change-Id: I83e11b9e7844fc27a4d8e538350ee4ca859e9055
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix inconsistency in hardware state
Cho KyongHo [Mon, 18 May 2015 07:37:49 +0000 (16:37 +0900)]
[COMMON] media: smfc: fix inconsistency in hardware state

Setting SMFC_DEV_RUNNING is after configuring H/W to start working.
If IRQ is occurred before configuring the flag, the IRQ handler
is called before the flag set.

Change-Id: I3f408f569b7265eb368b9efc38cffdb13d79fff2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix typo in comment
Cho KyongHo [Wed, 13 May 2015 05:35:31 +0000 (14:35 +0900)]
[COMMON] media: smfc: fix typo in comment

Fix errortum in comment 'aaray' to 'array'.

Change-Id: If3bc715bfd3b6772b19a920690de61691d2e3967
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix configuration to MAX_STREAM_SIZE register
Cho KyongHo [Wed, 13 May 2015 01:14:43 +0000 (10:14 +0900)]
[COMMON] media: smfc: fix configuration to MAX_STREAM_SIZE register

If SMFC finds that the compressed stream should be written over the
size configured in MAX_STREAM_SIZE register, it stops working and
asserts interrupt to the CPU that the destination buffer is too small
to store the compressed stream.
The restriction of the value in MAX_STREAM_SIZE:
 - The value should be multiple of 64
 - If the stream base is not aligned by 16 bytes, 64 - unaligned bytes
   should be added to the value.

Change-Id: I2198d001d93a8b6ad03a0c02f928bd1d65b85983
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix doubling number of planes
Cho KyongHo [Fri, 15 May 2015 10:57:08 +0000 (19:57 +0900)]
[COMMON] media: smfc: fix doubling number of planes

Doubling the number of planes in s_fmt() handler considers that the
number of buffers should be doubled the number of planes when back-
to-back compression is enabled. But it is implicitly configued during
qbuf(). Userspace qbufs double number of buffers than the number of
planes.

Change-Id: I70312ef199214cc3794c32ff2e8a719f5f11ffaf
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: remove empty function
Cho KyongHo [Fri, 15 May 2015 07:42:08 +0000 (16:42 +0900)]
[COMMON] media: smfc: remove empty function

smfc_configure_secondary_image() contains nothing.

Change-Id: I3c79c7ea588b75e69e2d895e54c129959c8f2c52
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: fix reversed order in printing index and value
Cho KyongHo [Thu, 14 May 2015 13:19:29 +0000 (22:19 +0900)]
[COMMON] media: smfc: fix reversed order in printing index and value

.buf_prepare() shows "Too small bytes_used[11985408]=0..." if
bytes_used in v4l2_buffer is smaller than the required buffer size
according to the image format configured with s_fmt. But the value in
the bracket should be the plane index and the value after equal sign
should be the value stored in .bytes_used.

Change-Id: I4697c5e8474db2b4291ac0a41dd928899c0cc183
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add support for HWFC configuration
Cho KyongHo [Mon, 4 May 2015 06:13:32 +0000 (15:13 +0900)]
[COMMON] media: smfc: add support for HWFC configuration

HWFC is configurable with V4L2_CID_JPEG_HWFC_ENABLE boolean control.
It is only configurable with YUV422 1-plane and YUV420 2-plane
without change in chroma subsampling ratio. Otherwise, users will
get error.

Change-Id: I09d0ac8b0cd6aa801ad611f3b8a065b84c00c4bf
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: return error if error found in .device_run()
Cho KyongHo [Mon, 4 May 2015 07:06:30 +0000 (16:06 +0900)]
[COMMON] media: smfc: return error if error found in .device_run()

There may be an error during pm_runtime_get() or clk_enable(). In that
situation, the driver should handle the exceptional cases.

Change-Id: If2ad5fc261eeb3e957a9abfeecac26fe66478d80
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: store control variables at the start of H/W run
Cho KyongHo [Mon, 4 May 2015 06:47:38 +0000 (15:47 +0900)]
[COMMON] media: smfc: store control variables at the start of H/W run

V4L2 control variables can be configured during H/W configuration.
Direct reference to the control variables several during H/W
configuration may result in inconsistent configuration to the H/W
because users may change the control variables during H/W
configurations. Therefore it is safe to keep a copy of the values
of the control variables before H/W configuration and to refer to
the copy. It is not important to configure the most latest values
of the control variables because the users do not know when the
H/W is configured.

Change-Id: I22a1b0d8a9ffa2e77b311559028fc2560a4eb122
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: wait until the current job finishes before suspending
Cho KyongHo [Thu, 23 Apr 2015 05:19:22 +0000 (14:19 +0900)]
[COMMON] media: smfc: wait until the current job finishes before suspending

The driver should ensure that the H/W controlled by the driver is in
idle state so that it is safe to enter the low power mode. SMFC driver
waits until the current job is finished and resuming completion of the
current job after resuming from the low power mode.

Change-Id: I4020a596342a4091fa1c64cdada033ca83c0b76e
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: cancel queued buffers in .stop_streaming()
Cho KyongHo [Tue, 21 Apr 2015 05:17:28 +0000 (14:17 +0900)]
[COMMON] media: smfc: cancel queued buffers in .stop_streaming()

stop_streaming() waits for all queued buffers to be finished. But SMFC
driver as a mem2mem device, may wait for the queued buffer of the
current vb2_queue while no buffer is queued in the other vb2_queue.
If .stop_streaming() is called in that situation, it waits for a
buffer to be queued to the other vb2_queue infinitely.
However it will never happen because no user will queue a buffer
during stopping operations on the device. Therefore, the driver
should see if other vb2_queue has a queued buffer when this vb2_queue
is stopping streaming. If the other vb2_queue has no queued buffer,
stop_streaming() should cancel all queued buffers in the current
vb2_queue.

Change-Id: I3b07916707a0b0d238a3238621fea631df8b942d
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add System MMU fault handler
Cho KyongHo [Fri, 10 Apr 2015 10:12:51 +0000 (19:12 +0900)]
[COMMON] media: smfc: add System MMU fault handler

Change-Id: Idb1a7cebb4dccb043dc834ceb4daacb5cdd7e983
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: support for secondary image compression
Cho KyongHo [Thu, 2 Apr 2015 07:07:11 +0000 (16:07 +0900)]
[COMMON] media: smfc: support for secondary image compression

SMFC supports for back-to-back image compression. It compresses two
images at the same time. Even though SMFC, itself has a single JPEG
compression engine, the users including the driver of SMFC feels that
the two source images are compressed concurrently because it provides
two sets of source image configuration registers and the users receive
two compressed data when the 'frame done' interrupt is asserted.

V4L2 does not consider about the special function like back-to-back
(B2B) compression which requires a couple of source images and results
different output streams for the source images. Thus SMFC driver
requires userspaces to provide the secondary image to compress in a
special way.
 - For B2B, the output and capture buffer type should be multi-plane.
 - All the format and buffer information passed to the driver from the
   the userspace should be the information of the primary image.
 - To B2B compression, the userspace should configure
    * The width and the height of the secondary image should be
      configured in the higher 16-bits of the fields of width and
      height of 'struct v4l2_format'
    * The color format of the secondary image should be the same as
      the primary image. Therefore there is no way to configure
      the color format of the secondary image.
    * The quality factor of the secondary image should be configured
      with the V4L2 control ID 'V4L2_CID_JPEG_CLASS_BASE + 20'.
      The parameter is the same as V4L2_CID_JPEG_COMPRESSION_QUALITY.
    * The buffer information of the secondary image should be
      specified from v4l2_buffer.m.plane[num_planes of the 1st image].
      v4l2_buffer.length should be also doubled because the effective
      planes are doubled. Otherwise, the users get failure.

Change-Id: I0f0abfe2ca2cc74219646fa4157dc41d5ef1e5b7
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: dump all control registers on an error interrupt
Cho KyongHo [Thu, 2 Apr 2015 07:27:36 +0000 (16:27 +0900)]
[COMMON] media: smfc: dump all control registers on an error interrupt

The current dump is based on Exynos7420 that is the most recent
version of H/W JPEG of the same series.

Change-Id: Ib674d6ce75addb60d94970c4abd3d019a66133f5
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add V4L2 control values
Cho KyongHo [Thu, 2 Apr 2015 01:39:17 +0000 (10:39 +0900)]
[COMMON] media: smfc: add V4L2 control values

SMFC Driver support JPEG class controls which includes quality factor,
chroma subsampling and restart interval.

Change-Id: I34fcd547a38696cd0f3576d6033a19a5f4fd754b
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: handle exceptional situations
Cho KyongHo [Wed, 1 Apr 2015 10:24:12 +0000 (19:24 +0900)]
[COMMON] media: smfc: handle exceptional situations

The driver should be robust under very exceptional situations caused
by unexpected behaviors of processes. Some processes may be suddenly
killed without waiting for the completion of request task in the
driver or H/W. Another processes that is not well-designed so that
they can close the opened device node while forgeting to wait for
the completion of their requested tasks.
Even though processes works unexpectedly, SMFC driver now handles
all exceptional cases with waiting for the H/W's working before
releasing all resources referred by the driver. Other resources that
the driver does not care about is handled by the frameworks such as
videobuf2 and v4l2-mem2mem.

Change-Id: I5ec4c3d91a9328e163658b3732a5ab37de30e73c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add basic function of compression by H/W
Cho KyongHo [Mon, 30 Mar 2015 10:51:59 +0000 (19:51 +0900)]
[COMMON] media: smfc: add basic function of compression by H/W

Now it is able to compress an image with H/W.

Change-Id: I420e4908b1e3c36818ae4be0b548d8c51ddb3fcc
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add qbuf/dqbuf V4L2 functions
Cho KyongHo [Mon, 30 Mar 2015 02:19:29 +0000 (11:19 +0900)]
[COMMON] media: smfc: add qbuf/dqbuf V4L2 functions

Change-Id: I897f41912b636287b6d00b96c7edc801e21d24fd
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add reqbufs and querybuf V4L2 functions
Cho KyongHo [Sun, 29 Mar 2015 13:02:02 +0000 (22:02 +0900)]
[COMMON] media: smfc: add reqbufs and querybuf V4L2 functions

Change-Id: I980e3ac016be5fd00a7f6aca78959db8943c696a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add g/try/s_fmt V4L2 functions
Cho KyongHo [Fri, 27 Mar 2015 01:08:45 +0000 (10:08 +0900)]
[COMMON] media: smfc: add g/try/s_fmt V4L2 functions

Change-Id: If8768fa8ef4f5ffa4318260545c2bfcea35fc296
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add querycap V4L2 function
Cho KyongHo [Fri, 27 Mar 2015 01:09:21 +0000 (10:09 +0900)]
[COMMON] media: smfc: add querycap V4L2 function

Change-Id: I3e16ac1bc6a630c9e5c0b6c831b57ae865760aa7
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add format definitions and enumeration
Cho KyongHo [Thu, 26 Mar 2015 06:04:40 +0000 (15:04 +0900)]
[COMMON] media: smfc: add format definitions and enumeration

Change-Id: Idf188d3d4a40195abea841e535ef7352bd593d02
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: add skelton implementation of v4l2.
Cho KyongHo [Wed, 25 Mar 2015 00:03:25 +0000 (09:03 +0900)]
[COMMON] media: smfc: add skelton implementation of v4l2.

The SMFC driver with V4L2 support is prepared. This patch includes
 - registration to video_device
 - buffer management with videobuf2-dma-sg
 - job scheduling by v4l2-mem2mem
 - V4L2 control handling by v4l2_fh
It is not the complete implementation. The following patches complete
the driver.

Change-Id: I19c3c5668c6ff975a7b55a0b9efc6147f94f143c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: smfc: introduce new SMFC driver
Cho KyongHo [Tue, 24 Mar 2015 07:55:35 +0000 (16:55 +0900)]
[COMMON] media: smfc: introduce new SMFC driver

Just probing is available.

Change-Id: I4f2c739cb847924253be4cfbe8f43b0d1f36d481
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[9610] arm64: defconfig: enable scaler
Janghyuck Kim [Mon, 21 May 2018 11:10:30 +0000 (20:10 +0900)]
[9610] arm64: defconfig: enable scaler

Change-Id: Ic6c7764c58c9d50fc72bdcd806b605154b8c50ba
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[9610] arm64: defconfig: enable g2d
hyesoo.yu [Wed, 23 May 2018 07:45:37 +0000 (16:45 +0900)]
[9610] arm64: defconfig: enable g2d

Change-Id: Ib96dafef5cb56d9bff819e003bbc2edc6e2e666b
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[9610] arm64: dtsi: add scaler node
Janghyuck Kim [Mon, 21 May 2018 11:10:11 +0000 (20:10 +0900)]
[9610] arm64: dtsi: add scaler node

Change-Id: Ie5164db4a8607417b4c68fa34909028901ac4bc2
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[9610] arm64: dtsi: add fimg2d node
hyesoo.yu [Wed, 23 May 2018 07:49:36 +0000 (16:49 +0900)]
[9610] arm64: dtsi: add fimg2d node

Change-Id: I7f02f9f186453240cb1585077f88f0abc8e1cc8f
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] media: v4l2-core: fix compat ioctl
Janghyuck Kim [Thu, 12 Apr 2018 06:18:12 +0000 (15:18 +0900)]
[COMMON] media: v4l2-core: fix compat ioctl

Copying reserved2 field was missed, and signedness of reserved2 field
was chagned. This patch corrected these bugs.

Change-Id: Ia04ead949d34c42392efab2200fc1ca78a0d64b8
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add V4L2_CAP_FENCES capability
Janghyuck Kim [Wed, 4 Apr 2018 06:54:14 +0000 (15:54 +0900)]
[COMMON] media: scaler: add V4L2_CAP_FENCES capability

Change-Id: I01879c9c5b6e439c8b53f8384092491d5e0814b6
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months agomedia: v4l2-core: fix v4l2-core to use fence
Janghyuck Kim [Tue, 3 Apr 2018 06:47:28 +0000 (15:47 +0900)]
media: v4l2-core: fix v4l2-core to use fence

V4L2 explicit synchronization is supported by v4l2-core, however, some
changes were needed for compatiblity of other v4l2 driver.

fence_fd in v4l2_buffer is changed from reserved2 to reserved.
reserved2 field has been used for other driver, and legacy scaler driver
used reserved field for their fence information. This change could
guarantee compatibility of previous user API.

Some spinlock location of fence_cb_lock were moved to avoid running
buf_queue callback in interrupt context.

Finally, additional check routine was removed in vb2_buffer_done().
This routine made invalid address access, and it is used for unordered
queue. Currently it is not needed, so it will be reverted later after
find the reason of invalid address access.

Change-Id: I618b1d4320cfb95508727fc418ebe0f9fae7183a
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] v4l: Document explicit synchronization
Janghyuck Kim [Fri, 23 Mar 2018 09:48:12 +0000 (18:48 +0900)]
[media] v4l: Document explicit synchronization

Add section to VIDIOC_QBUF and VIDIOC_QUERY_BUF about it

v6: - Close some gaps in the docs (Hans)

v5:
- Remove V4L2_CAP_ORDERED
- Add doc about V4L2_FMT_FLAG_UNORDERED

v4:
- Document ordering behavior for in-fences
- Document V4L2_CAP_ORDERED capability
- Remove doc about OUT_FENCE event
- Document immediate return of out-fence in QBUF

v3:
- make the out_fence refer to the current buffer (Hans)
- Note what happens when the IN_FENCE is not set (Hans)

v2:
- mention that fences are files (Hans)
- rework for the new API

Change-Id: I011c3e013caed2431c330eed1afeb8f52fe52ddc
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] v4l: introduce the fences capability
Janghyuck Kim [Fri, 23 Mar 2018 09:46:26 +0000 (18:46 +0900)]
[media] v4l: introduce the fences capability

Drivers capable of using fences (vb2 drivers) should report the
V4L2_CAP_FENCES to userspace, so add this flag to the uapi.

Change-Id: I61d994bfb768aced3242c304d6e4f22a8d806b1d
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] vb2: add out-fence support to QBUF
Janghyuck Kim [Fri, 23 Mar 2018 09:45:49 +0000 (18:45 +0900)]
[media] vb2: add out-fence support to QBUF

If V4L2_BUF_FLAG_OUT_FENCE flag is present on the QBUF call we create
an out_fence and send its fd to userspace on the fence_fd field as a
return arg for the QBUF call.

The fence is signaled on buffer_done(), when the job on the buffer is
finished.

v9: - remove in-fences changes from this patch (Alex Courbot)
- improve fence context creation (Hans Verkuil)
- clean up out fences if vb2_core_qbuf() fails (Hans Verkuil)

v8:
- return 0 as fence_fd if OUT_FENCE flag not used (Mauro)
- fix crash when checking not using fences in vb2_buffer_done()

v7:
- merge patch that add the infrastructure to out-fences into
this one (Alex Courbot)
- Do not install the fd if there is no fence. (Alex Courbot)
- do not report error on requeueing, just WARN_ON_ONCE() (Hans)

v6
- get rid of the V4L2_EVENT_OUT_FENCE event. We always keep the
ordering in vb2 for queueing in the driver, so the event is not
necessary anymore and the out_fence_fd is sent back to userspace
on QBUF call return arg
- do not allow requeueing with out-fences, instead mark the
  buffer
with an error and wake up to userspace.
- send the out_fence_fd back to userspace on the fence_fd field

v5:
- delay fd_install to DQ_EVENT (Hans)
- if queue is fully ordered send OUT_FENCE event right away
(Brian)
- rename 'q->ordered' to 'q->ordered_in_driver'
- merge change to implement OUT_FENCE event here

v4:
- return the out_fence_fd in the BUF_QUEUED event(Hans)

v3: - add WARN_ON_ONCE(q->ordered) on requeueing (Hans)
- set the OUT_FENCE flag if there is a fence pending (Hans)
- call fd_install() after vb2_core_qbuf() (Hans)
- clean up fence if vb2_core_qbuf() fails (Hans)
- add list to store sync_file and fence for the next queued
  buffer

v2: check if the queue is ordered.

Change-Id: I5c63827350c67ba703ce6a2b2fb4818bcc721846
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] vb2: add in-fence support to QBUF
Janghyuck Kim [Fri, 23 Mar 2018 09:41:04 +0000 (18:41 +0900)]
[media] vb2: add in-fence support to QBUF

Receive in-fence from userspace and add support for waiting on them
before queueing the buffer to the driver. Buffers can't be queued to the
driver before its fences signal. And a buffer can't be queue to the
driver
out of the order they were queued from userspace. That means that even
if
it fence signal it must wait all other buffers, ahead of it in the
queue,
to signal first.

If the fence for some buffer fails we do not queue it to the driver,
instead we mark it as error and wait until the previous buffer is done
to notify userspace of the error. We wait here to deliver the buffers
back
to userspace in order.

v9: - rename fence to in_fence in many places
- handle fences signalling with error better (Hans Verkuil)

v8: - improve comments and docs (Hans Verkuil)
- fix unlocking of vb->fence_cb_lock on vb2_core_qbuf (Hans
  Verkuil)
- move in-fences code that was in the out-fences patch here
  (Alex)

v8: - improve comments about fences with errors

v7:
- get rid of the fence array stuff for ordering and just use
get_num_buffers_ready() (Hans)
- fix issue of queuing the buffer twice (Hans)
- avoid the dma_fence_wait() in core_qbuf() (Alex)
- merge preparation commit in

v6:
- With fences always keep the order userspace queues the
  buffers.
- Protect in_fence manipulation with a lock (Brian Starkey)
- check if fences have the same context before adding a fence
  array
- Fix last_fence ref unbalance in __set_in_fence() (Brian
  Starkey)
- Clean up fence if __set_in_fence() fails (Brian Starkey)
- treat -EINVAL from dma_fence_add_callback() (Brian Starkey)

v5: - use fence_array to keep buffers ordered in vb2 core when
needed (Brian Starkey)
- keep backward compat on the reserved2 field (Brian Starkey)
- protect fence callback removal with lock (Brian Starkey)

v4:
- Add a comment about dma_fence_add_callback() not returning a
error (Hans)
- Call dma_fence_put(vb->in_fence) if fence signaled (Hans)
- select SYNC_FILE under config VIDEOBUF2_CORE (Hans)
- Move dma_fence_is_signaled() check to __enqueue_in_driver()
  (Hans)
- Remove list_for_each_entry() in __vb2_core_qbuf() (Hans)
-  Remove if (vb->state != VB2_BUF_STATE_QUEUED) from
vb2_start_streaming() (Hans)
- set IN_FENCE flags on __fill_v4l2_buffer (Hans)
- Queue buffers to the driver as soon as they are ready (Hans)
- call fill_user_buffer() after queuing the buffer (Hans)
- add err: label to clean up fence
- add dma_fence_wait() before calling vb2_start_streaming()

v3: - document fence parameter
- remove ternary if at vb2_qbuf() return (Mauro)
- do not change if conditions behaviour (Mauro)

v2:
- fix vb2_queue_or_prepare_buf() ret check
- remove check for VB2_MEMORY_DMABUF only (Javier)
- check num of ready buffers to start streaming
- when queueing, start from the first ready buffer
- handle queue cancel

Change-Id: I2c45f8f98e7d3a3026286e25934e64d0bebfc4f4
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months agoRevert "media: videobuf2-core: dequeue if start_streaming fails"
Cosmin Tanislav [Wed, 17 Apr 2024 11:47:18 +0000 (14:47 +0300)]
Revert "media: videobuf2-core: dequeue if start_streaming fails"

This reverts commit 9e38c674ed71a7a05f9c35660951d0956134b6b2.

6 months ago[media] vb2: add explicit fence user API
Janghyuck Kim [Fri, 23 Mar 2018 09:34:10 +0000 (18:34 +0900)]
[media] vb2: add explicit fence user API

Turn the reserved2 field into fence_fd that we will use to send
an in-fence to the kernel or return an out-fence from the kernel to
userspace.

Two new flags were added, V4L2_BUF_FLAG_IN_FENCE, that should be used
when sending a fence to the kernel to be waited on, and
V4L2_BUF_FLAG_OUT_FENCE, to ask the kernel to give back an out-fence.

v6: - big improvement on doc (Hans Verkuil)

v5:
- keep using reserved2 field for cpia2
- set fence_fd to 0 for now, for compat with userspace(Mauro)

v4:
- make it a union with reserved2 and fence_fd (Hans Verkuil)

v3:
- make the out_fence refer to the current buffer (Hans Verkuil)

v2: add documentation

Change-Id: Ic52ac856718b716c0eda3cae983e32817f09991e
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] v4l: add 'unordered' flag to format description ioctl
Janghyuck Kim [Fri, 23 Mar 2018 07:36:37 +0000 (16:36 +0900)]
[media] v4l: add 'unordered' flag to format description ioctl

For explicit synchronization it important for userspace to know if the
format being used by the driver can deliver the buffers back to
userspace
in the same order they were queued with QBUF.

Ordered streams fits nicely in a pipeline with DRM for example, where
ordered buffer are expected.

v2 - Improve documentation (Hans)

Change-Id: I5f0361407c7e50cf7eadb754bc977ed28de87527
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[media] vb2: add is_unordered callback for drivers
Janghyuck Kim [Fri, 23 Mar 2018 07:34:55 +0000 (16:34 +0900)]
[media] vb2: add is_unordered callback for drivers

Explicit synchronization benefits a lot from ordered queues, they fit
better in a pipeline with DRM for example so create a opt-in way for
drivers notify videobuf2 that the queue is unordered.

Drivers don't need implement it if the queue is ordered.

v2: - improve comments for is_unordered flag (Hans)

v3: - make it bool (Hans)
- create vb2_ops_set_unordered() helper

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Change-Id: I519c8576f2fd1b83e60a4da40c169b16b86ef825
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months agov4l2-compat-ioctl32: copy extra v4l2_buffer fields from user
Cho KyongHo [Thu, 22 Feb 2018 12:13:35 +0000 (21:13 +0900)]
v4l2-compat-ioctl32: copy extra v4l2_buffer fields from user

reserved field of v4l2_buffer structure delivers an acquire fence for
rendering devices implementing V4L2 for Android.
timecode, sequence and reserved2 fields of v4l2_buffer structure are
required by MFC driver and ExynosOMX.

Change-Id: Id1c7ef3b8b5d8574172d12ee52110d881e75585c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Signed-off-by: CHOIHYOJOO <hyoj.choi@samsung.com>
6 months ago[COMMON] media: videobuf2-v4l2: fix bug for multiplane
Won Jung [Thu, 26 May 2016 13:19:35 +0000 (22:19 +0900)]
[COMMON] media: videobuf2-v4l2: fix bug for multiplane

In __fill_v4l2_buffer, q->is_multiplaner is used
to check whether multiplane is requested.
However, at this point, do not refer the condition
because it is not determined yet.
Therefore, using the macro, V4L2_TYPE_IS_MULTIPLANAR(), and
type, the member value in struct v4l2_buffer, the condition
(multiplane) is checked.

Change-Id: I84ce7a39020de53423ba094dd10fc712deba8d1b
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: videobuf2-v4l2: keep the reserved2 field
Jeonghee Kim [Fri, 26 Jan 2018 05:25:28 +0000 (14:25 +0900)]
[COMMON] media: videobuf2-v4l2: keep the reserved2 field

The reserved2 field should be keeped,
because this is used for extension interface
between user space and kernel space.

Change-Id: I9bb33d4ffa599f48b97c1604848ccdc4d0095310
Signed-off-by: Ayoung Sim <a.sim@samsung.com>
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
6 months agomedia: vb2: add support for iovmm in vb2-dma-sg
Cho KyongHo [Thu, 11 Jan 2018 00:51:20 +0000 (09:51 +0900)]
media: vb2: add support for iovmm in vb2-dma-sg

Address space management of DMA above System MMU in Exynos SoCs is not
constructed in dma-mapping but in iovmm that only provides address
space management for such DMAs. Therefore we should call iovmm_map()
and iovmm_unmap() explicitely even though videobuf2-dma-sg already
calls dma_map_sg() for mapping.
The client v4l2 drivers are intended to get DMA address from the
scatter-gather list returned by vb2_dma_sg_plane_desc() but
iovmm_map() leave it untouched because dma addresses in the scatter-
gather list is also used by cache maintenance. Therefore, DMA
addresses returned by iovmm_map() should be maintained separately.
We also provide vb2_dma_sg_plane_dma_addr() to find the DMA address
of a plane.

Change-Id: I4773d342716431d7ea889bb5e11ac3512d8193ba
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: add version information
Janghyuck Kim [Thu, 15 Mar 2018 02:11:10 +0000 (11:11 +0900)]
[COMMON] media: scaler: add version information

Change-Id: Iebd38f9623354a45ea75dc88c0bdcef50fdc944c
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months agoRevert "[COMMON] media: scaler: add debugging log for g2d power domain"
Janghyuck Kim [Thu, 15 Mar 2018 02:09:21 +0000 (11:09 +0900)]
Revert "[COMMON] media: scaler: add debugging log for g2d power domain"

This reverts commit 5ea20f792414b4fb75c252f6accfe44e436c7233.

Change-Id: Idaa49e72fda38ee192fb86beacf02f8a6409b798
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>