GitHub/LineageOS/android_kernel_motorola_exynos9610.git
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>
6 months agomedia: scaler: fix use of ION api for 4.14 kernel
Cho KyongHo [Mon, 12 Feb 2018 05:26:33 +0000 (14:26 +0900)]
media: scaler: fix use of ION api for 4.14 kernel

ION is dramatically changed in 4.14 kernel including kernel API and
the header files. But the symantics of ION API is not changed.

Change-Id: I82d5d73ced2399c894bc2962198cd6e72fdb50f6
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: fix prevent issue
Janghyuck Kim [Thu, 23 Nov 2017 08:14:15 +0000 (17:14 +0900)]
[COMMON] media: scaler: fix prevent issue

This patch fixed dead default in switch issue.

CID 197211

Change-Id: I1f3bec73cc6216e749ca603734e25e95752db56d
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add explict cache maintenance
Cho KyongHo [Tue, 11 Oct 2016 11:19:38 +0000 (20:19 +0900)]
[COMMON] media: scaler: add explict cache maintenance

m2m1shot now provides m2m1shot_sync_for_device/cpu() functions that
explicitly cleaning or invalidating CPU caches. This patch follows
"media: m2m1shot: use exynos_iovmm_map_userptr()" which separate
cache maintenance from m2m1shot_map/unmap_dma_buf().

Change-Id: I8eac9cf955fff3f07aa00a6ea86f401245e21be3
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: add reset sequence for scaler 5.0.1
Janghyuck Kim [Mon, 21 Aug 2017 02:33:25 +0000 (11:33 +0900)]
[COMMON] media: scaler: add reset sequence for scaler 5.0.1

Change-Id: Iedfb4b3a0ac1b544ad62e2da062c4cab547f00b1
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add minor version information
Janghyuck Kim [Wed, 16 Aug 2017 05:10:24 +0000 (14:10 +0900)]
[COMMON] media: scaler: add minor version information

Change-Id: I3e20742826a69c72fe87bb92b3e02c1ca15a0b27
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: 10bit size calculation for V4L2_PIX_FMT_NV12N_10B
Janghyuck Kim [Wed, 21 Jun 2017 08:31:12 +0000 (17:31 +0900)]
[COMMON] media: scaler: 10bit size calculation for V4L2_PIX_FMT_NV12N_10B

V4L2_PIX_FMT_NV12N_10B was missed for 10bit size calculation.

Change-Id: I6cb0582ae7e00b5c91a9362e9bd9b35603def47b
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add context dump for debugging
Janghyuck Kim [Tue, 30 May 2017 06:33:36 +0000 (15:33 +0900)]
[COMMON] media: scaler: add context dump for debugging

This patch added information of context that can be useful for
unexpected error case.

Change-Id: I826634b4220ae9a12d9be9fdbbab26908f2333a2
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add devfreq setting
Janghyuck Kim [Sat, 15 Jul 2017 10:55:22 +0000 (19:55 +0900)]
[COMMON] media: scaler: add devfreq setting

S_CTRL for framerate setting is added.
If user setting framerate of context, it is considered that pm qos lock
is required to guarantee scaler performance. User can remove pm qos lock
by setting framerate as zero explicitly, or it can be removed
automatically if context is closed.

Change-Id: I8e24e0f7ad24e1ed2fed2cc80a8c35495c32a531
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: get rid of padding for 2bit CbCr
Janghyuck Kim [Mon, 19 Jun 2017 12:15:05 +0000 (21:15 +0900)]
[COMMON] media: scaler: get rid of padding for 2bit CbCr

In case of S10B pixel format, padding bytes for 2bit CbCr does not
necessary.

Change-Id: I66fd0197c53690beb1d94e5315eea5c0b6ec88b1
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[HACK] media: scaler: add extra size for source buffer
Janghyuck Kim [Mon, 12 Jun 2017 13:01:30 +0000 (22:01 +0900)]
[HACK] media: scaler: add extra size for source buffer

Change-Id: Ie54f0c1b897943109e0ddc84cd3f7c66b047cf16
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: support 10bit pixel format
Janghyuck Kim [Sat, 6 May 2017 08:50:19 +0000 (17:50 +0900)]
[COMMON] media: scaler: support 10bit pixel format

This patch supports 10bit pixel format that listed in below.

V4L2_PIX_FMT_NV12M_S10B
V4L2_PIX_FMT_NV12M_P010
V4L2_PIX_FMT_NV16M_S10B
V4L2_PIX_FMT_NV61M_S10B

Change-Id: Idabb2476333add13b895ef0725211df0a23dec0f
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: move ion_client from int_frame to dev
Janghyuck Kim [Sat, 6 May 2017 09:09:33 +0000 (18:09 +0900)]
[COMMON] media: scaler: move ion_client from int_frame to dev

ion_client is used for internal buffer allocation, but it would be
complicated and hard to manage when it is used for int_frame and
mid_buf. So it is moved to sc_dev.

Change-Id: Ie16119f2871246d0dc886b31d27d689197e50ca4
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: cleaning up buffer allocation related code
Janghyuck Kim [Fri, 28 Apr 2017 12:45:33 +0000 (21:45 +0900)]
[COMMON] media: scaler: cleaning up buffer allocation related code

This patch cleans up repetitive code for plane size calculation and
buffer allocation and free of intermediate buffer.

How to calculate plane size varies depending on the pixel format
conditions, however, many repetitive code was used. Common calculation
code is separated by one function.

Intermediate buffer allocation was repetitive and easy to mistake. It is
cleaned up by changing sc_addr structure to use array. It contains
removing redundant code for prefetch buffer.

Change-Id: Iea75d7f204e0addcebfc187b96eb8466320e5fd9
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: update coef table for 10bit processing
Janghyuck Kim [Sat, 6 May 2017 07:31:19 +0000 (16:31 +0900)]
[COMMON] media: scaler: update coef table for 10bit processing

Scaler coef table values are updated because 10bit pixelformat support
accompanied valid bit extension for coefficient value.

Change-Id: Ibde9ad8bdc1f95856021f40e1ce67c11e3485c03
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: remove csc table for DCI-P3
Janghyuck Kim [Fri, 19 May 2017 02:17:01 +0000 (11:17 +0900)]
[COMMON] media: scaler: remove csc table for DCI-P3

csc table for DCI-P3 is not used.

Change-Id: I2fed0147641f1b37dc97d5395342a56f743bcba9
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: add scaler version 5.0
Janghyuck Kim [Sat, 6 May 2017 05:36:17 +0000 (14:36 +0900)]
[COMMON] media: scaler: add scaler version 5.0

Change-Id: Ic3c6a0f6fe40cf6b79af69cbb05bb53758aebe24
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months ago[COMMON] media: scaler: support 960p dnoise filter
woncheon.an [Thu, 30 Mar 2017 10:35:05 +0000 (19:35 +0900)]
[COMMON] media: scaler: support 960p dnoise filter

Change-Id: Iba96e068f7b9da2faba24aa171a701366034cd5c
Signed-off-by: woncheon.an <woncheon.an@samsung.com>
6 months ago[COMMON] media: scaler: add debugging log for g2d power domain
woncheon.an [Mon, 13 Feb 2017 06:42:32 +0000 (15:42 +0900)]
[COMMON] media: scaler: add debugging log for g2d power domain

We get the channel information before suspend resume callback to
debug the hw state.

Change-Id: I395a8fa01209e209a3e36ac9b7d75e7adc4117ee
Signed-off-by: woncheon.an <woncheon.an@samsung.com>
6 months ago[COMMON] media: scaler: delete unnecessary check code
woncheon.an [Mon, 6 Feb 2017 08:07:43 +0000 (17:07 +0900)]
[COMMON] media: scaler: delete unnecessary check code

Minumum size of Src is 16x16 and minimum size of Dst is 4x4.
So deleted check code is always false
Therefore Src->Dst scaling ratio check code is unnecessary

Change-Id: I383e0765a4db33ff337fb675c07e145c4ca5ec37
Signed-off-by: woncheon.an <woncheon.an@samsung.com>
6 months ago[COMMON] media: scaler: fix buffer free during working
Cho KyongHo [Thu, 26 Jan 2017 06:32:17 +0000 (15:32 +0900)]
[COMMON] media: scaler: fix buffer free during working

Scaler driver is able to run H/W twice to support the users who want
to zoom out the given image by the larger minification factor than the
factor H/W supports. It is called pre-scaling and pre-scaling requires
a temporary buffer that is not supplied by the users but allocaged by
Scaler driver itself.
Scaler driver allocates the buffer when it finds that pre-scaling is
required and frees when it notices that the pre-scaling is not needed
any more. However the driver has a flaw of logic in sc_release() that
releases the temporary buffer before waiting for the H/W to be done.
It results in accessing a freed buffer by H/W.

Change-Id: I951de839884382b9806a744aac92ec4d083fa689
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: modify minimum size check condition.
woncheon.an [Wed, 1 Feb 2017 11:35:41 +0000 (20:35 +0900)]
[COMMON] media: scaler: modify minimum size check condition.

There's possibility that intermediate frame size violate to
minimum input size during 2nd operation. but previous code
can't check about minumum size restirction if ratio conditional sentence is false
So intermediate frame size check codes are moved backward

Change-Id: Icf0d01571037dc5f4c95c1acc66db1704370c9d1
Signed-off-by: woncheon.an <woncheon.an@samsung.com>
6 months ago[COMMON] media: scaler: fix possible clk enable after shutdown
Cho KyongHo [Mon, 9 Jan 2017 08:29:12 +0000 (17:29 +0900)]
[COMMON] media: scaler: fix possible clk enable after shutdown

sc_shutdown() is called during system shutdown and it marks drvdata
that it is under shutdown state. However, a task is requested to be
processed after sc_shutdown() is called, sc_run_next_job() enables
the power and the clocks of Scaler even though the power domain is
already detached.

Change-Id: Ib90ac0d870a381a4e3a99455a749ff42ff0d5565
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: fix power-off bug for scaler
Won Jung [Fri, 6 Jan 2017 01:26:02 +0000 (10:26 +0900)]
[COMMON] media: scaler: fix power-off bug for scaler

There is a possibility which g2d block power off
while scaler is running. A scaler is in the g2d block.
In interrupt handler, rm_runtim functions, pm_runtime_get
or pm_runtime_put, are uesed as asynchronous mode.
But since a wating job can be called in interrupt handler,
g2d block power is turned off due to the asyncchronous
pm_runtime_put function while the job is performing.
Therefore, the pm_runtime_put should be called after
the wating job which performs in irq handler is done.

Change-Id: If342b2cc4b57714d6183486b4b54b1b21b1c1472
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: wait device stop running locklessly
Cho KyongHo [Wed, 28 Dec 2016 14:17:15 +0000 (23:17 +0900)]
[COMMON] media: scaler: wait device stop running locklessly

Since "fec3dab [8895] media: scaler: add mutex lock" patch has been
applied, the following problem is reported:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:617
in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0
CPU: 0 MPIDR: 80000100 PID: 0 Comm: swapper/0 Tainted: G        W       4.4.13-10228462-eng #1
Hardware name: Samsung SM-G955F rev00 board based on EXYNOS8895 (DT)
Call trace:
[<ffffffc00008a254>] dump_backtrace+0x0/0x110
[<ffffffc00008a378>] show_stack+0x14/0x20
[<ffffffc0003892b4>] dump_stack+0xa8/0xe4
[<ffffffc0000d5220>] ___might_sleep+0x244/0x258
[<ffffffc0000d52ac>] __might_sleep+0x78/0x8c
[<ffffffc000c240ec>] mutex_lock_nested+0x3c/0x3bc
[<ffffffc00075490c>] sc_m2m1shot_device_run+0x30/0xd4
[<ffffffc000746b74>] m2m1shot_task_schedule+0x90/0xd8
[<ffffffc00074735c>] m2m1shot_task_finish+0x78/0x90
[<ffffffc000752338>] sc_irq_handler+0x4a4/0x4f4
[<ffffffc00010b84c>] handle_irq_event_percpu+0x15c/0x418
[<ffffffc00010bb4c>] handle_irq_event+0x44/0x78
[<ffffffc00010ef04>] handle_fasteoi_irq+0xc4/0x138
[<ffffffc00010af80>] generic_handle_irq+0x1c/0x30
[<ffffffc00010b060>] __handle_domain_irq+0xcc/0x11c
[<ffffffc0000814f8>] gic_handle_irq+0x70/0xcc

It is caused by the mutex lock introduced by the above patch and the
mutex is required for modifying DEV_SUSPEND and testing DEV_RUN
atomically.

However, the problem that a new task starts running between testing
DEV_SUSPEND and testing DEV_RUN in sc_suspend() and sc_shutdown() is
basically caused by the sc_irq_handler() that clears DEV_RUN before
testing DEV_SUSPEND. Therefore, the problem of running an unexpected
task is simply solved by moving clearing DEV_RUN after testing
DEV_SUSPEND.

Change-Id: I7deed59fc636868d062a63ba8c5b2bd5b9f3c753
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: scaler: modify BT709 narrow csc coef. value
Won Jung [Thu, 1 Dec 2016 02:12:20 +0000 (11:12 +0900)]
[COMMON] media: scaler: modify BT709 narrow csc coef. value

Change-Id: I499bdb052680ef019364c196887a7b45a5b3140e
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: add the shutdown callback
Won Jung [Wed, 21 Sep 2016 08:34:07 +0000 (17:34 +0900)]
[COMMON] media: scaler: add the shutdown callback

if shutdown, scaler 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: I7a2367ff02faf7355d11b9ca23661bb6e3ec8629
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: modify codes for size align
Won Jung [Mon, 22 Aug 2016 07:57:43 +0000 (16:57 +0900)]
[COMMON] media: scaler: modify codes for size align

Modify codes for size align. This work is for yuv422
and yuv420 formats. In the formats, must be set
as an even number.

Change-Id: I0925f1592244bf79dfc421f8c3f27bfd48180a20
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: add swrst in case of errors
Won Jung [Fri, 19 Aug 2016 11:56:59 +0000 (20:56 +0900)]
[COMMON] media: scaler: add swrst in case of errors

add swrset to go into power down mode if error
is asserted

Change-Id: Ib098c1856185df9514378f5b2b151a5c182bfe57
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: Remove smc call for cfw
Won Jung [Wed, 3 Aug 2016 06:17:44 +0000 (15:17 +0900)]
[COMMON] media: scaler: Remove smc call for cfw

Do not need smc call for cfw in KC

Change-Id: Ibc546cecfd3340d5da076659e23f858ed5b8dd05
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: add double scaling feature
Won Jung [Thu, 21 Jul 2016 05:32:52 +0000 (14:32 +0900)]
[COMMON] media: scaler: add double scaling feature

For scaling up/down over the constraints, scaler driver
performs double scaling. Moreover, it supports drm play.

Change-Id: Id0e7b8f71754a9423432acced67a9bf4269101ff
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: add scaler version
Won Jung [Tue, 21 Jun 2016 01:12:40 +0000 (10:12 +0900)]
[COMMON] media: scaler: add scaler version

add scaler version (4.0.1) due to hw version change.

Change-Id: Ic64b1723cdffd51cfcc4e181c040ff92d5e8ff3a
Signed-off-by: Won Jung <w00.jung@samsung.com>
6 months ago[COMMON] media: scaler: add scaler driver for kernel 4.9
haksong [Thu, 19 May 2016 07:23:20 +0000 (16:23 +0900)]
[COMMON] media: scaler: add scaler driver for kernel 4.9

Change-Id: I8be3927f6d21f8bdb51a42160c148caf474a57fc
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 months agomedia: m2m1shot: fix ion header file
Cho KyongHo [Mon, 12 Feb 2018 05:25:35 +0000 (14:25 +0900)]
media: m2m1shot: fix ion header file

ION is dramatically changed in 4.14 kernel including header file name.

Change-Id: Ie224ea1718b55000696b081e22643e4ca19ecc46
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: m2m1shot: fix implicit type conversion
Cho KyongHo [Thu, 23 Nov 2017 08:21:08 +0000 (17:21 +0900)]
[COMMON] media: m2m1shot: fix implicit type conversion

Prevent CID: 201932

Change-Id: I506141fee3de6d9d4e62b83ab4211bdf84a3c366
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: m2m1shot: use exynos_iovmm_map_userptr()
Cho KyongHo [Mon, 10 Oct 2016 14:23:54 +0000 (23:23 +0900)]
[COMMON] media: m2m1shot: use exynos_iovmm_map_userptr()

Pinning user buffer with get_user_pages() is very time-consuming.
Discard using get_user_pages() and get benefit from
exynos_iovmm_map_userptr().

Change-Id: I68c5a2c082d18e930cbc4908914d1af4e19ab7a0
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] media: add m2m1shot files for kernel 4.9
haksong [Thu, 19 May 2016 07:55:37 +0000 (16:55 +0900)]
[COMMON] media: add m2m1shot files for kernel 4.9

Change-Id: I9e59f47b5996fa91775245f8a63c661e2cabae55
Signed-off-by: haksong <haksong@samsung.com>
6 months ago[9610] g2d: add support for Exynos9610
Cho KyongHo [Fri, 18 May 2018 03:12:18 +0000 (12:12 +0900)]
[9610] g2d: add support for Exynos9610

The features of G2D of Exynos9610 is the same as Exynos9810 except
supporting source layers.

Change-Id: Ia5b69fd25b5ab02c742a8ec71eafc4fe601ead3a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add support for YCbCr 10-bit of Exynos9820
Cho KyongHo [Wed, 11 Apr 2018 07:39:03 +0000 (16:39 +0900)]
g2d: add support for YCbCr 10-bit of Exynos9820

YCbCr 10-bit configuration to REG_LAYERX_COLORMODE of exynos9820 is
different from exynos9810. Since G2D driver uses the values to the
register as color format values, changes in the bitfields of
REG_LAYERX_COLORMODE also impacts to color format values.

Change-Id: I7e6bb03601db3aa3e34316a51070abd92d878832
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: fix build error on clang
hyesoo.yu [Thu, 29 Mar 2018 04:18:58 +0000 (13:18 +0900)]
[COMMON] g2d: fix build error on clang

Change-Id: I504dd9670d9374d62b8482cf6f12d9686591b781
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agog2d: improve readability of cmd alignment check
Cho KyongHo [Tue, 13 Mar 2018 05:42:30 +0000 (14:42 +0900)]
g2d: improve readability of cmd alignment check

The number of commands in a command list should be a multiple of 8.
Calculating of the remainder of the division of the number of commands
by 8 and adding dummy commands as many as the remainder is not that
intuitive.

Change-Id: I15134fd06be7ff71236c283369c9041b5e954977
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add debugfs node about states of tasks
Cho KyongHo [Sat, 17 Mar 2018 12:37:50 +0000 (21:37 +0900)]
g2d: add debugfs node about states of tasks

When G2D driver is not able to allocate a free task, we are curious
about the states of each task. debugs/g2d/tasks shows details of all
tasks including flags, state flags, priority and the time of starting
job and the time of the completion of the job.

Change-Id: I617f98169daaaca851bfd7c0dc52245ab96c624d
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: improve readability of debugfs/g2d/logs
Cho KyongHo [Mon, 12 Mar 2018 13:08:26 +0000 (22:08 +0900)]
g2d: improve readability of debugfs/g2d/logs

It is very difficult to understand logs of debugfs/g2d/logs because
it is not human readable. The log is transformed for humans:

before:
[   0] 4:15@1 (0x 4)      0 45742336
[   1] 4:15@2 (0x 4)      1 45743711
[   2] 4: 0@0 (0x 0)      0 45743948
[   3] 4:15@3 (0x10)    251 45743964
[   4] 0: 0@4 (0x 0)  32768 45744660
[   5] 0:15@5 (0x10)    697 45744664
[   6] 4:15@1 (0x 0)      1 45745184
[   7] 0: 0@0 (0x 0)      1 45747519

after:
[2:    77250240]    task_alloc: JOB ID 15 (STATE 0x004) - alloc
[2:    77252363]    task_begin: JOB ID 15 (STATE 0x004) - 1
[2:    77253063]    runtime_pm: in
[2:    77253087]     task_push: JOB ID 15 (STATE 0x010) - 722 usec.
[0:    77253791]           irq: 0x8000
[0:    77253795]     task_done: JOB ID 15 (STATE 0x010) - 705 usec.
[0:    77254048]    runtime_pm: out
[2:    77254610]    task_alloc: JOB ID 15 (STATE 0x000) - free

Change-Id: I6d0a735f259f86ecaa90abba662ec49727460524
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: change layer security setting
Cho KyongHo [Tue, 13 Mar 2018 05:37:42 +0000 (14:37 +0900)]
g2d: change layer security setting

Initialization of the regster at 0x30 guarantees G2D working correctly
on both of Exynos9810 and Exynos9820. On the other hand, initialzing
the register at 0x34 effects nothing.

Change-Id: I015ce6f7e873e10527d02a318010d004c66e2ed3
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add debugfs node of details of open contexts
Cho KyongHo [Thu, 30 Nov 2017 15:30:44 +0000 (00:30 +0900)]
g2d: add debugfs node of details of open contexts

Change-Id: Ic9cf4c397cbc2815223a536c0a1e125a22737210
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add error log when no free task slot found
Cho KyongHo [Fri, 1 Dec 2017 04:59:12 +0000 (13:59 +0900)]
g2d: add error log when no free task slot found

Change-Id: I28d4af981117a26f45b90137338fe7045bc879e4
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add log of execution failure by priority
Cho KyongHo [Thu, 30 Nov 2017 15:40:51 +0000 (00:40 +0900)]
g2d: add log of execution failure by priority

Change-Id: Ie6648726506be751fc4b9a03c6e374ae3c8c9b64
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: add support for Secure DRM of Exynos9820
Cho KyongHo [Mon, 5 Mar 2018 08:00:47 +0000 (17:00 +0900)]
g2d: add support for Secure DRM of Exynos9820

Protected contents of Secure DRM are processed by G2D if post image
prosessing is needed. G2D in Exynos9810 needs help of the secure world
due to the lack of prevention of protected contents leak to non-secure
world.
G2D in Exynos9820 does not need the help of the secure world because
it is guaranteed that G2D does not leak the protected contents.

Change-Id: I11028c774fe8b59cd21f7c6f391ae1949fd78767
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: remove conditional compile for Secure DRM
Cho KyongHo [Mon, 5 Mar 2018 06:55:56 +0000 (15:55 +0900)]
g2d: remove conditional compile for Secure DRM

CONFIG_EXYNOS_CONTENT_PATH_PROTECTION is defined when Secure DRM is
ready. Statements that depend on CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
are split by #ifdef for the selective compilation.
But the conditional compilation makes code readers hard to understand
the source code and therefore easy to make mistakes during maintenance
of the source code.
Conditional compilation by CONFIG_EXYNOS_CONTENT_PATH_PROTECTION is
also needed to be removed for G2D of Exynos9820 that does not rely on
the secure world to run both of secure and non-secure G2D jobs.

Change-Id: I097c6ab051f8c3cdefdc6a84a9509d94c2f3149d
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: remove redundant cache flush
Cho KyongHo [Mon, 5 Mar 2018 07:03:39 +0000 (16:03 +0900)]
g2d: remove redundant cache flush

g2d_flush_command_page() cleans the command list for the secure world
to update the commands in the list correctly. But it is also done in
g2d_hw_push_task().

Change-Id: Ic69c0d8cbb11fecd673411f1aa6d2ed19f3bd493
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: fix use of ION API for 4.14 kernel
Cho KyongHo [Mon, 12 Feb 2018 05:50:34 +0000 (14:50 +0900)]
g2d: fix use of ION API for 4.14 kernel

ION is dramatically changed in 4.14 kernel including kernel API and
the header files. But the symantics of ION API is not changed.

Change-Id: I24ca55a603d5a39ce0da40d18782e40b4a14e43b
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: delete timer before initialization
Cho KyongHo [Thu, 18 Jan 2018 08:49:35 +0000 (17:49 +0900)]
g2d: delete timer before initialization

Change-Id: I20e08cb2ec0e4cb9760a3bd29acada138fbcf231
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: fix fence timeout handling
Cho KyongHo [Fri, 19 Jan 2018 03:20:34 +0000 (12:20 +0900)]
g2d: fix fence timeout handling

If an fence timeout is caused by unsignaled fences, G2D driver
forcefully schedules the task to H/W because it is not a good idea
that a driver waits for a fence to be signaled undefinitely.

Sometimes fence timeout is happened when a task queued in the
workqueue is pended too long. We don't need to restart the fence
timer again because is has no meaning to recover the situation.
Moreover, it may corrupt the timer initialized for H/W timeouts if
the restarting timer for fence happens later than initializing the
timer for H/W.

In the most cases, fence timeout is happened by unsigned fences. The
counter task.starter is not zeroed when the expired task is forcefully
started. It makes confusing when debugging problems related to
timeouts.

Change-Id: I2bdcc9df1b891cdeaf315b3380f41a99cc5a3ce0
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months agog2d: fix BUG() when logging events
Cho KyongHo [Wed, 17 Jan 2018 04:48:12 +0000 (13:48 +0900)]
g2d: fix BUG() when logging events

The following message caused by smp_processor_id() when it is not
called in atomic context to keep the consistency of the processor
id during the task related to the processor id is completed.

<3>[   66.158972]  [7:composer@2.1-se: 1919] BUG: using smp_processor_id() in preemptible [00000000] code: composer@2.1-se/1919
<4>[   66.158989]  [7:composer@2.1-se: 1919] caller is debug_smp_processor_id+0x1c/0x24
<4>[   66.158999]  [7:composer@2.1-se: 1919] CPU: 7 PID: 1919 Comm: composer@2.1-se Tainted: G S              4.14.13-g7ad8263aec9d #83
<4>[   66.159006]  [7:composer@2.1-se: 1919] Hardware name: Samsung UNIVERSAL9810 board based on EXYNOS9810 (DT)
<4>[   66.159012]  [7:composer@2.1-se: 1919] Call trace:
<4>[   66.159024]  [7:composer@2.1-se: 1919] [<ffffff800808b4f4>] dump_backtrace+0x0/0x418
<4>[   66.159032]  [7:composer@2.1-se: 1919] [<ffffff800808b920>] show_stack+0x14/0x1c
<4>[   66.159042]  [7:composer@2.1-se: 1919] [<ffffff80087a442c>] dump_stack+0x88/0xac
<4>[   66.159049]  [7:composer@2.1-se: 1919] [<ffffff800837cca4>] check_preemption_disabled+0xd0/0xf4
<4>[   66.159055]  [7:composer@2.1-se: 1919] [<ffffff800837cce4>] debug_smp_processor_id+0x1c/0x24
<4>[   66.159065]  [7:composer@2.1-se: 1919] [<ffffff80084324c0>] g2d_stamp_task+0xa0/0x104
<4>[   66.159071]  [7:composer@2.1-se: 1919] [<ffffff800842ac90>] g2d_ioctl+0x374/0x424
<4>[   66.159080]  [7:composer@2.1-se: 1919] [<ffffff8008203a64>] vfs_ioctl+0x20/0x38
<4>[   66.159086]  [7:composer@2.1-se: 1919] [<ffffff8008204548>] do_vfs_ioctl+0x9c0/0xa6c
<4>[   66.159093]  [7:composer@2.1-se: 1919] [<ffffff8008204654>] SyS_ioctl+0x60/0x88

Even though g2d driver does not need the consistency because it just
uses it for logging the current CPU, it is required to kill the
unnecessary messages.

Change-Id: Ie6be45bc1457cb8936c388f80bc9b837fb4d2afa
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[HACK] g2d: ignore performance request
Cho KyongHo [Tue, 16 Jan 2018 02:03:38 +0000 (11:03 +0900)]
[HACK] g2d: ignore performance request

PMQOS for peripherals is not ready in the kernel.

Change-Id: Ib6b7b3f0a0ce3f8d3ccaa2008db0ac5edea79435
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: remove BITBLT_START_REG on commands
hyesoo.yu [Thu, 28 Dec 2017 01:45:25 +0000 (10:45 +0900)]
[COMMON] g2d: remove BITBLT_START_REG on commands

The BITBLT_START_REG is not necessary to run the job
manager

Change-Id: I538a9725107123c504612912d29f5a9664cbe291
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: kill the task when the invalid condition
hyesoo.yu [Tue, 19 Dec 2017 09:50:27 +0000 (18:50 +0900)]
[COMMON] g2d: kill the task when the invalid condition

kill the task and show the debugging information
when every tasks pushed to g2d H/W are queued.

Change-Id: Id0c26c37979936b9b0942364438f9899c17e013a
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: remove from qos contexts on release
hyesoo.yu [Wed, 27 Dec 2017 01:42:01 +0000 (10:42 +0900)]
[COMMON] g2d: remove from qos contexts on release

Context should be removed from qos context
to prevent access after being removed on release
although g2d still needs performance

Change-Id: Id4dae0f3dc7d142c95c5e6de50503f3857289830
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] gpu: g2d: fix implicit type conversion
Cho KyongHo [Thu, 23 Nov 2017 08:05:04 +0000 (17:05 +0900)]
[COMMON] gpu: g2d: fix implicit type conversion

Prevent CID: 202021
Prevent CID: 202003
Prevent CID: 202000
Prevent CID: 201961
Prevent CID: 201909
Prevent CID: 201887
Prevent CID: 201224

Change-Id: I93b6f65617f0e25e11e63eff0fe46da42f3a0117
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: increase g2d INT lock for performance
hyesoo.yu [Fri, 17 Nov 2017 08:31:33 +0000 (17:31 +0900)]
[COMMON] g2d: increase g2d INT lock for performance

Change-Id: I80c007b17986f38dff865ca47b8d176bb89d5742
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: disable sharabiltiy feature on g2d"
hyesoo.yu [Tue, 14 Nov 2017 10:00:55 +0000 (19:00 +0900)]
Revert "[COMMON] g2d: disable sharabiltiy feature on g2d"

This reverts commit 591b3c1c10af821c54eab5b72121e99ffa6c4772.

Change-Id: I59dc83d3660c35b06b4221725cf223574534a66f
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix the error for cache flush of target
hyesoo.yu [Mon, 13 Nov 2017 06:15:19 +0000 (15:15 +0900)]
[COMMON] g2d: fix the error for cache flush of target

Change-Id: I6b5d081fcf781797872e7072e52965fadf2585d5
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: disable sharabiltiy feature on g2d
Cho KyongHo [Mon, 13 Nov 2017 02:28:30 +0000 (11:28 +0900)]
[COMMON] g2d: disable sharabiltiy feature on g2d

Change-Id: I294f5974c57618cdae9aff5354f188db5334bfc5
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: clear sharability attribute
hyesoo.yu [Mon, 25 Sep 2017 10:11:35 +0000 (19:11 +0900)]
[COMMON] g2d: clear sharability attribute

If the device doesn't support the sharablity, S bit
should be cleared on system page table.

Change-Id: I49d5e843d81e43ce5a176720823afbdf36de6681
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix out-of-bound of fence name
hyesoo.yu [Thu, 9 Nov 2017 06:43:05 +0000 (15:43 +0900)]
[COMMON] g2d: fix out-of-bound of fence name

Fix global-out-of-bounds to copy the fence name

Change-Id: I388a2f007868e98612f62f23bc8bc0a632a8883c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: eliminate unnecessary cache maintenance
hyesoo.yu [Thu, 2 Nov 2017 12:47:44 +0000 (21:47 +0900)]
[COMMON] g2d: eliminate unnecessary cache maintenance

The g2d execute cache maintencance only for the cachable
buffer that is accessed by GPU if device is coherent,
so condition check for cache maintenance is fixed.

Change-Id: I9b8fa16cddcd12c00ed95fc08e4d4e179411938e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: split the dump function
hyesoo.yu [Wed, 1 Nov 2017 05:27:21 +0000 (14:27 +0900)]
[COMMON] g2d: split the dump function

In an abnormal state, there may not be any task to run
even in mmu fault and error interrupt state, and
this case might be accessed to NULL pointer on stamp
function, so split the debugging message function
from stamp function and print more information.

Change-Id: Iadb1838c166cdfa3f4221a4ed30888734ba6303f
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add support for custom tone mapping LUT
Cho KyongHo [Mon, 16 Oct 2017 06:58:53 +0000 (15:58 +0900)]
[COMMON] g2d: add support for custom tone mapping LUT

The look-up table for tone mapping can be overwritten by the superuser
through the module parameter of hdr_tunables module intorduced by
"video: hdr: add tunable parameters for HDR" commit.
Once tone mapping LUT has been written to the parameter and becomes
valid, it is immediately applied to every tasks executed by G2D. All
tone mapping coefficients are overwritten with the values in the
paramter.

Change-Id: I871bfe6d9ab4740ad8519b09f0a5b1bce257d1c3
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] video: hdr: add tunable parameters for HDR
Cho KyongHo [Thu, 12 Oct 2017 08:03:25 +0000 (17:03 +0900)]
[COMMON] video: hdr: add tunable parameters for HDR

It is required to tune HDR LUT values during runtime because the
quality of HDR processing is measured on the display of DUT. It means
that some LUT values including LUTs of tone mapping might need to be
tunned if the display controller or LCD is changed.

Change-Id: Ic927345a25f6b2d45d7be9de47f2a0574514ff64
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add afbc debugging information
hyesoo.yu [Thu, 19 Oct 2017 12:29:47 +0000 (21:29 +0900)]
[COMMON] g2d: add afbc debugging information

Show the internal state on AFBC decoder core when timeout
or error interrupt, mmu fault happens.

Change-Id: Ia2ae7cdc4137c7e2ef8ba3eb4dc86c7128915e9c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: cancel callback of acquire fence
hyesoo.yu [Mon, 16 Oct 2017 11:39:19 +0000 (20:39 +0900)]
[COMMON] g2d: cancel callback of acquire fence

If the user request has error parameter, the acquire
fence was put but the callback of fence is remained.
The new request on the same task structure registers
the callback to another fence, the list was corrupted.

It makes panic or hard lockup on system, so fix it.

Change-Id: I19ccbc06668c0d418fee675bf53188c6c37db3f9
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add limitations of H/W flow control
hyesoo.yu [Tue, 10 Oct 2017 06:40:02 +0000 (15:40 +0900)]
[COMMON] g2d: add limitations of H/W flow control

When G2D performs a H/W Flow Control job, following
limitations are observed,

1. Does not support AFBC format is not supported
as the destination format
2. Z-Order of tile order is not supported

Change-Id: I0f5f0f08602a9000ee417e2ea349434a3af8a4a4
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add support for BGR565
Cho KyongHo [Wed, 27 Sep 2017 11:16:32 +0000 (20:16 +0900)]
[COMMON] g2d: add support for BGR565

Change-Id: Iafdcfb030c01d770796548ef4d8c0a7488ebce93
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add extra information for debug
hyesoo.yu [Mon, 25 Sep 2017 00:12:30 +0000 (09:12 +0900)]
[COMMON] g2d: add extra information for debug

First, we add the time from user request to H/W start,
and from H/W start to H/W finishing.
Second, we record H/W status on error interrupt or H/W
timeout without exception.
Third, we record whether the task has compressed format
or not when acquire fence timeout happens due to possibility
to read without writing all.

Change-Id: Idd0b274f23f6221af1e652482f23957d7931bf4e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix to read the job state
hyesoo.yu [Mon, 25 Sep 2017 01:35:59 +0000 (10:35 +0900)]
[COMMON] g2d: fix to read the job state

The register of JOB_IDn_STATE should be masked
to read the job state.

Change-Id: I964c2a22073d64a3c9150fa06e2060192c5d149d
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix unintended sign extension
hyesoo.yu [Fri, 15 Sep 2017 08:34:08 +0000 (17:34 +0900)]
[COMMON] g2d: fix unintended sign extension

Multiplying crop_w and crop_h could be promoted in
type signed 32bit, then signed extended to type
unsigned long long, so fix signed extension.

Change-Id: Id10e2c04fef0ab1a682bc5b65c7d86e2da256725
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>