GitHub/LineageOS/android_kernel_motorola_exynos9610.git
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>
6 months ago[COMMON] g2d: fix to access the NULL pointer
hyesoo.yu [Fri, 8 Sep 2017 05:33:48 +0000 (14:33 +0900)]
[COMMON] g2d: fix to access the NULL pointer

Fix referencing a pointer that might be null &mm->mmap_sem
when calling down_read

Change-Id: I5e960fac24e6218f0ef71fe33d8e72bfa119d268
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix out-of-bounds read
hyesoo.yu [Fri, 8 Sep 2017 05:29:16 +0000 (14:29 +0900)]
[COMMON] g2d: fix out-of-bounds read

Overrunning array release_fences of 17 4-byte elements at
element index 4294967294 (byte offset 17179869176) using index

Change-Id: I18d984096c8975fb2afc38a2785baf8e5505ca4d
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: set CAPTURE_IDX for every tasks
hyesoo.yu [Mon, 28 Aug 2017 04:32:45 +0000 (13:32 +0900)]
[COMMON] g2d: set CAPTURE_IDX for every tasks

Even if it is a normal task, command list must
explicitly be stated in CAPTURE_IDX that it is not
a hwfc task.

Change-Id: Ic2d766d4bd5bf15b2e684e90e91d602f9c65176b
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: release performance lock
hyesoo.yu [Fri, 18 Aug 2017 02:21:56 +0000 (11:21 +0900)]
[COMMON] g2d: release performance lock

If there is no further request from the user for 50ms,
performance lock is released automatically.

Change-Id: Id36220bbe6eecd45c716fd1c83f3e12f523c3f82
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: move setting hwfc data
hyesoo.yu [Fri, 18 Aug 2017 00:59:12 +0000 (09:59 +0900)]
[COMMON] g2d: move setting hwfc data

HWFC buffer information sholud be set from
repeater driver before payload calculation.

Change-Id: I1497b1673ead7fc4edcae6df1e0ce5ff095b2bdb
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix unsigned datatype
hyesoo.yu [Wed, 16 Aug 2017 02:08:13 +0000 (11:08 +0900)]
[COMMON] g2d: fix unsigned datatype

'get_unused_fd_flags' is stored in unsigned datatype,
so could not be handled on error.

Change-Id: I9447fd5fd7ccb9d6cdb782607197ad24360058fc
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix formula based on measured value
hyesoo.yu [Wed, 9 Aug 2017 09:37:08 +0000 (18:37 +0900)]
[COMMON] g2d: fix formula based on measured value

H/W performance varies depending on scaling ratio,
size, rotation and format. Based on the measured
times, PPC is calculated again.

Change-Id: I8993e20aee1c94f5a07290fe754e612c66adc8da
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: show HDR coefficients
hyesoo.yu [Thu, 10 Aug 2017 05:18:34 +0000 (14:18 +0900)]
[COMMON] g2d: show HDR coefficients

Add the debug information for HDR coefficients

Change-Id: I2c59c9030197061265f85a6d5aef59184343211a
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix the security hole
hyesoo.yu [Fri, 14 Jul 2017 04:23:08 +0000 (13:23 +0900)]
[COMMON] g2d: fix the security hole

Secure layer information could be changed at any time
on normal OS. That is, someone can change the destination
from secure to normal by hacking maliciously.

To solve this problem, modify that every task has
been pushed in the secure world.

Change-Id: Ic6a35920452f49bd735a4e3545a22d71cba7c190
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: fix the security hole"
hyesoo.yu [Thu, 24 Aug 2017 01:23:06 +0000 (10:23 +0900)]
Revert "[COMMON] g2d: fix the security hole"

This reverts commit 1bf32e2b0e09c41067a2ed93bc14655649393095.

Change-Id: Ic189da048a05e819a82430556603953f77bdc8f7
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: show HDR coefficients"
hyesoo.yu [Thu, 24 Aug 2017 01:22:35 +0000 (10:22 +0900)]
Revert "[COMMON] g2d: show HDR coefficients"

This reverts commit f28d97ad694fdf55d37c514cc0946af17ea2070f.

Change-Id: I07a7024b2922d3551dc7ea7e1a648750af189e0b
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: fix formula based on measured value"
hyesoo.yu [Thu, 24 Aug 2017 01:22:22 +0000 (10:22 +0900)]
Revert "[COMMON] g2d: fix formula based on measured value"

This reverts commit 8b6985f10269521f49d54bcf17ee731cca671dd3.

Change-Id: I56b70b99e2e94378c9014dc3aad623fb769f46ad
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: fix unsigned datatype"
hyesoo.yu [Thu, 24 Aug 2017 01:20:20 +0000 (10:20 +0900)]
Revert "[COMMON] g2d: fix unsigned datatype"

This reverts commit 15ffb6b6f57e0e8152d3e0b647ae3454fbc8cb40.

Change-Id: Ibdbdefc7e542290d335d2ea98a6881b5151c7880
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: move setting hwfc data"
hyesoo.yu [Thu, 24 Aug 2017 01:19:56 +0000 (10:19 +0900)]
Revert "[COMMON] g2d: move setting hwfc data"

This reverts commit 713b7ef688f8b3e3276f073bf8c3c620d30f31e9.

Change-Id: If0f3894a02f7fdec90b229040658d7c2d8096b58
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months agoRevert "[COMMON] g2d: release performance lock"
hyesoo.yu [Thu, 24 Aug 2017 01:22:07 +0000 (10:22 +0900)]
Revert "[COMMON] g2d: release performance lock"

This reverts commit e17b747d223fd86c18f6e110658489f6aba706d8.

Change-Id: I254fe53b13a63981cd9fc9d72f2d8c412576d52e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: release performance lock
hyesoo.yu [Fri, 18 Aug 2017 02:21:56 +0000 (11:21 +0900)]
[COMMON] g2d: release performance lock

If there is no further request from the user for 50ms,
performance lock is released automatically.

Change-Id: If1548cf253d74fbf2ea5034077989d8072cbfd23
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: move setting hwfc data
hyesoo.yu [Fri, 18 Aug 2017 00:59:12 +0000 (09:59 +0900)]
[COMMON] g2d: move setting hwfc data

HWFC buffer information sholud be set from
repeater driver before payload calculation.

Change-Id: Ia8717c99a991a0db5441a745b58d884a3a51328b
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix unsigned datatype
hyesoo.yu [Wed, 16 Aug 2017 02:08:13 +0000 (11:08 +0900)]
[COMMON] g2d: fix unsigned datatype

'get_unused_fd_flags' is stored in unsigned datatype,
so could not be handled on error.

Change-Id: I009949ab228689bc0aed21615894ecdb9de926ea
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix formula based on measured value
hyesoo.yu [Wed, 9 Aug 2017 09:37:08 +0000 (18:37 +0900)]
[COMMON] g2d: fix formula based on measured value

H/W performance varies depending on scaling ratio,
size, rotation and format. Based on the measured
times, PPC is calculated again.

Change-Id: I6fcfef745ec83eda26647a5d4bad9c994cff4a3f
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: show HDR coefficients
hyesoo.yu [Thu, 10 Aug 2017 05:18:34 +0000 (14:18 +0900)]
[COMMON] g2d: show HDR coefficients

Add the debug information for HDR coefficients

Change-Id: Ic2af15a1b127d908ab04534bf99581fb3602a46a
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix the security hole
hyesoo.yu [Fri, 14 Jul 2017 04:23:08 +0000 (13:23 +0900)]
[COMMON] g2d: fix the security hole

Secure layer information could be changed at any time
on normal OS. That is, someone can change the destination
from secure to normal by hacking maliciously.

To solve this problem, modify that every task has
been pushed in the secure world.

Change-Id: I1e1a272f8fea8d8fa78c060696b3fa457165c4a2
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add support for inverse dither of sources
Cho KyongHo [Wed, 16 Aug 2017 08:36:34 +0000 (17:36 +0900)]
[COMMON] g2d: add support for inverse dither of sources

Change-Id: Idd859b6c5595e41136183029891da3aff34f3a7c
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: remove to overwrite priority.
hyesoo.yu [Fri, 28 Jul 2017 00:57:26 +0000 (09:57 +0900)]
[COMMON] g2d: remove to overwrite priority.

The priority of context always set the priority of
task, however the priority of user's task data
overwrite the task priority.

Change-Id: Ib172b5021ed0841588c738e5c0dd5aa626abb6f7
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: calculate the laptime.
hyesoo.yu [Tue, 25 Jul 2017 06:56:14 +0000 (15:56 +0900)]
[COMMON] g2d: calculate the laptime.

The time is calculated after completing the task

Change-Id: I1c1fced152fcb3198eab5cb93a1b4d1638e6137c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: change mode to secure before running
hyesoo.yu [Thu, 20 Jul 2017 00:51:13 +0000 (09:51 +0900)]
[COMMON] g2d: change mode to secure before running

The existing has problem because the secure mode is not
enabled again when suspend resume happens.
Therefore the secure mode is changed immediately before
running to resolve the problem.

Change-Id: I4fe22d81fc241d99276d4eac5fc8b8db32777fb7
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: unlock the spinlock on error handling
hyesoo.yu [Wed, 19 Jul 2017 13:40:11 +0000 (22:40 +0900)]
[COMMON] g2d: unlock the spinlock on error handling

The workqueue must be terminated after the spinlock
has been released. However, that is missing when
handing of suspend, so fix it.

BUG: workqueue leaked lock or atomic: kworker/u16:8/0x00000001/5856

Change-Id: I6f9a36095dd9673dd57e38f24a3d306e1407529a
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add fimg2d node
hyesoo.yu [Fri, 7 Jul 2017 02:35:16 +0000 (11:35 +0900)]
[COMMON] g2d: add fimg2d node

The user that opens "fimg2d" has permission 0x666,
so this user doesn't have authority to request priority
or performance, because the user that has high authority
should not be disturbed by lower authority user.

Change-Id: Ie9af31be60d7d2d80df3fdae561547d8db82440c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix mask for command
hyesoo.yu [Tue, 18 Jul 2017 10:30:30 +0000 (19:30 +0900)]
[COMMON] g2d: fix mask for command

Fix the command mask for opaque flag

Change-Id: I0c668401cf3afd35bf8fb91ae9f0e742fb0572f2
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add support for compat_ioctl
hyesoo.yu [Mon, 17 Jul 2017 04:39:56 +0000 (13:39 +0900)]
[COMMON] g2d: add support for compat_ioctl

Change-Id: I7e499a525202f720ba1a1f3f70d1c944e4988d49
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add ABGR2101010 format
hyesoo.yu [Mon, 17 Jul 2017 05:22:01 +0000 (14:22 +0900)]
[COMMON] g2d: add ABGR2101010 format

The bit encoding of ABGR2101010 format in little endian:
31  29    20 19    10 9      0
+--+--------+--------+--------+
| A|    B   |    G   |   R    |
+--+--------+--------+--------+

It can be expressed as a bytes sequence as follows:
RRRRRRRR GGGGGGRR BBBBGGGG AABBBBBB

Change-Id: Ie574e083cc1b4538710e752b1fd3aabdf8d855ea
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: set the qos and device frequency
hyesoo.yu [Fri, 16 Jun 2017 07:44:51 +0000 (16:44 +0900)]
[COMMON] g2d: set the qos and device frequency

The driver calculates the needed frequency by
frame information from user for performance.

Change-Id: I99b8c2a98efac2a6bab07de19b3d04dd29cd2a74
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add priority setting
hyesoo.yu [Mon, 26 Jun 2017 09:35:26 +0000 (18:35 +0900)]
[COMMON] g2d: add priority setting

All contexts have priority. The requested task inherits
the priority of the context. Updating the priority of the context
always succeeds, but EBUSY could be returned if other tasks is running
or queued with a priority lower than its own.

If the priority of the context is lower than the priority of
the other context, the driver doesn't accept lower context's request,
It is called S/W preemption.

Change-Id: I82650f516ac019eb77f853a948b7f11cfe0578ae
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix the error handling for fence
hyesoo.yu [Thu, 6 Jul 2017 01:46:47 +0000 (10:46 +0900)]
[COMMON] g2d: fix the error handling for fence

The return value is fixed when error happens.

Change-Id: I44d335b1412a0e2d8861a19edf6b3dffa8b38c91
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add the hwfc
hyesoo.yu [Thu, 11 May 2017 07:12:19 +0000 (16:12 +0900)]
[COMMON] g2d: add the hwfc

Support hw flow control between MFC and G2D.

The hw flow control is that g2d H/W writes destination,
and inform MFC of written line count of destination,
so MFC could read from destination of G2D even if the
operation is not completed yet.

To support hwfc, driver performs following process.

First, driver get the shared buffer from repeater driver
that has role of shared buffer management and set the
destination before H/W run.

Second, set the reserved job id from 0 to MAX_SHARED_BUF_NUM
that is the same of buffer index received from repeater driver.

Finally, driver set register related HWFC.

Change-Id: If4c646928017db9198448b68745e4e818eb5de6c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] repeater: add header file
shinwon.lee [Thu, 25 May 2017 12:16:34 +0000 (21:16 +0900)]
[COMMON] repeater: add header file

Change-Id: Ie3dc83448db200ddb140c9742e8c8cde68d1abac
Signed-off-by: shinwon.lee <shinwon.lee@samsung.com>
6 months ago[COMMON] g2d: added fence_put() after fence is created
hyesoo.yu [Mon, 10 Jul 2017 06:40:09 +0000 (15:40 +0900)]
[COMMON] g2d: added fence_put() after fence is created

The patch 8fba9cde9b815209e8f8fcd2587c85860b17ad06
hold reference to fence when creating sync_file.

After fence_init and create sync_file, fence reference
has increased twice, so we send the release fence after
decreasing the reference because the user receiving
the release fence expects the fence to increase once.

Change-Id: I3091c685790ac9f05284a8c4786a6f9312a8f674
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: fix spinlock lockup for fence
hyesoo.yu [Tue, 20 Jun 2017 06:13:28 +0000 (15:13 +0900)]
[COMMON] g2d: fix spinlock lockup for fence

CPU1 CPU2
spin_lock_irqsave(task->fence_timeout_lock)

fence_signal_locked() /* called with fence->lock held */
g2d_fence_callback()
spin_lock_irqsave(task->fence_timeout_lock)
g2d_fence_timeout_handler()
fence_remove_callback()
spin_lock_irqsave(fence->lock)

On the above condition, two spinlock are deadlocked.

So, move fence_remove_callback() from fence_timeout_lock section.

Change-Id: If023ac94c2130ec0320814f3f2dc638c0031e761
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: increase starter before adding callback
hyesoo.yu [Tue, 20 Jun 2017 05:45:30 +0000 (14:45 +0900)]
[COMMON] g2d: increase starter before adding callback

Always increase task->starter before adding callback
to avoid unexpected operation.

CPU1 CPU2

kref_init(&task->starter);
g2d_get_userdata();
fence_add_callback(fence);
g2d_fence_callback(fence);
kref_put(&task->starter);
g2d_queuework_task();
g2d_device_run();
kref_get(&task->starter);

On the above condition, that forces to run H/W without
getting user data. It makes various types of errors.

Change-Id: Id775237894e7aedcb0c4feb180ab44646557ef5e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add debugging feature
hyesoo.yu [Wed, 24 May 2017 11:27:49 +0000 (20:27 +0900)]
[COMMON] g2d: add debugging feature

remove the spinlock on g2d_dump_task to avoid spinlock
lockup and add the stamp at each task state for debug

Change-Id: I449dbe41d56bdbb0dc468b970e2c9102c2b46979
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: flush cmd page for secure sysmmu
hyesoo.yu [Wed, 14 Jun 2017 06:56:43 +0000 (15:56 +0900)]
[COMMON] g2d: flush cmd page for secure sysmmu

the command page is mapped on secure sysmmu without
sharable. so, we have to flush the cmd page before
pushing the page for when the command page is mapped
on only secure sysmmu.

Change-Id: Ia9a50336aaafb3452c4089652a8369b00a938439
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: support constraints of MFC
Cho KyongHo [Wed, 31 May 2017 13:52:38 +0000 (22:52 +0900)]
[COMMON] g2d: support constraints of MFC

MFC has the following constraints for buffer access:
- Stride (for both of Luman and Chroma including 2-bit planes)
  - width stride: 16 bytes
  - height alignment: 16 pixels
- Padding:
  - Dummy 256 bytes should be padded between the end of luma and the
    beginning of chroma
  - Dummy 64 bytes(256/4) should be padded between the end of the
    8-bit data and the beginning of the 2-bit data for both of luma
    and chroma.

G2D driver checks and applies the above constraints if
G2D_LAYERFLAG_MFC_STRIDE is set to layer->flags and the format is
YCbCr420 semi-planar. If the format is 8+2 YCbCr420 semi-planar and
the number of buffers is two, the above constraints are applied even
though G2D_LAYERFLAG_MFC_STRIDE is not set.

Change-Id: I3071a7949cf96ac2e80f4845cc1bd189eec51ba6
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: fix RGB and Cb/Cr order
Cho KyongHo [Wed, 31 May 2017 13:51:13 +0000 (22:51 +0900)]
[COMMON] g2d: fix RGB and Cb/Cr order

The order of Cb and Cr was reversed in the format definition.
R and B was also reversed for RGB565.

Change-Id: Ifff9ad199cff5e889b844b3357a97619f152bd5f
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add the task control register
hyesoo.yu [Fri, 12 May 2017 12:39:46 +0000 (21:39 +0900)]
[COMMON] g2d: add the task control register

If rotated area is larger than the non-rotated area,
H/W changes the writing direction. At this time,
if the destination is YUV 2plane, uses the Z-order
to reduce write bandwidth.

Secondly, H/W can process two jobs in parallel, so it
can be processed by dividing the target area into two.

Change-Id: I67e2dd4189d0f5f7dd92305a3ddf1771b507d086
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: support secure mode
hyesoo.yu [Wed, 24 May 2017 04:33:58 +0000 (13:33 +0900)]
[COMMON] g2d: support secure mode

Support to blend the secure layer. To access the secure layer,
it must enable secure mode of G2D from secure world,
and command area must be mapped to secure mmu.

When both normal and secure tasks are running at the same time
on H/W queue, confilcts could be occurred by turning on/off
the secure mode, which reads the command area from
secure or normal sysmmu.

So, always turn on the secure mode and map the command to
secure mmu.

Change-Id: Ia15796e611a9b6f98181183c556d4f4848fa455e
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add the fence timeout
hyesoo.yu [Mon, 22 May 2017 12:54:48 +0000 (21:54 +0900)]
[COMMON] g2d: add the fence timeout

Give up waiting the acquire fences that are not currently signaled
and force pushing this pending task to the H/W to avoid indefinite
wait for the fences to be signaled.

Change-Id: I6ff0e77d6ccffc249fd0374018c7ff15e666d756
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 months ago[COMMON] g2d: add System MMU fault handler
Cho KyongHo [Mon, 8 May 2017 04:36:09 +0000 (13:36 +0900)]
[COMMON] g2d: add System MMU fault handler

System MMU fault handler is registers to show the status of H/W and
the driver when unexpected fault is occurred in System MMU for
debugging purpose..

Change-Id: Ibe58a3a8f1b7e90c1a41875be20a18708075c5ad
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: Add command list completion
Cho KyongHo [Thu, 4 May 2017 09:37:49 +0000 (18:37 +0900)]
[COMMON] g2d: Add command list completion

To push a command list to H/W, G2D driver should add some required
information to the command list including:
- initialization of H/W for the new job
- information about the layers involved with the job.
- information about secure layers.
The driver should also satisfies the requirment of H/W. It includes
alignment restriction of the number of commands in the command list.
If the number of commands are not multiple of 8, the driver appends
some redundant commands to satisfy the restriction.

Change-Id: Ia986f95de7df8e96907cac0cf7197f1fc3560db8
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add support for dma-buf fence
Cho KyongHo [Mon, 1 May 2017 11:13:54 +0000 (20:13 +0900)]
[COMMON] g2d: add support for dma-buf fence

G2D driver needs to wait for the fences to be signaled to schedlue a
task if they are attached to layers of that task. Users may needs G2D
driver to deliver fences to know when the G2D H/W completes processing
on a job.
G2D driver impelements such buffer synchronization with dma-buf fence
and exports the fence to sync_file to give the fences for the job
completion, which are called release fences. The driver does not
generate a new fence for every single buffers that needs release
fences. Instead, it generates a single release fence and exports to
multiple sync_files as many as the user required. It reduces the use
of resources and simplifies the fence management in the driver.

Change-Id: I31f2c5156b29d7a1bb8096b4c34811cbc75c679a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add cache maintenance
Cho KyongHo [Mon, 1 May 2017 07:16:44 +0000 (16:16 +0900)]
[COMMON] g2d: add cache maintenance

If G2D is a shareable device, CPU caches do not need to be manually
maintained by G2D driver. But there is one exception when shareable
G2D needs to read a cacheable buffer written by a non-shareabe device.
G2D driver should invalidate speculatively prefetched data possibly
loaded into CPU caches before reading the buffer shareably.

Change-Id: I6dbae852034f3cd1849977f15190cd4412c2bf08
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: get userdata
Cho KyongHo [Thu, 27 Apr 2017 08:42:29 +0000 (17:42 +0900)]
[COMMON] g2d: get userdata

This patch defines the interface between userspace and the driver. G2D
driver does not define a formal structure for the information about
jobs to process in H/W. Instead, it receives a set of commands to H/W.
The driver then just checks if the commands contains an invalid value
that may harm H/W. It does not check if the values in the commands are
correctly specified as the expectation of the user.

However, the driver allows the users to specifiy commands in a
restricted form. This restriction removes ambiguities about
specification of commans in userspace because it clears users the
information that needs to be specified in the command list. It also
relieves the driver from the heavy command validation workloads. The
driver does not need to validate the offset and the command of every
single command in the command list.
The driver defines the number and the order of commands. Even though
commands are not specified in the order as the expectation of the
driver, it pushes the commands to H/W if the commands are not harmful.

With the restriction, the driver does not allow users to specify some
sensitive commands including security management, H/W control, layer
management. The information related to the sensitive commands are
delivered to the driver in a well-defined form of data structure. The
driver then validates the information in the data structure and
generates commands for the information after the validation.

Change-Id: I4a792adb084eecdeb3f890a701178ddb1ca069af
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add support for suspend and shutdown
Cho KyongHo [Mon, 24 Apr 2017 02:05:23 +0000 (11:05 +0900)]
[COMMON] g2d: add support for suspend and shutdown

When the system is going to be suspeded to RAM, all the drivers should
complete their active tasks and freeze their working. G2D driver
registers pm notifiers to get informed about the time of suspend a bit
earlier than .suspend() callback function called by dpm. Likewise, it
makes the driver know the time of wake-up later than the invokation of
.resume() callback function. It is important for the driver because
RPM is detached before .suspend() is called and attached after
.resume().
Before suspend, G2D driver waits completion of all jobs running in H/W
and blocks all further jobs not to be pushed to H/W. The blocked jobs
are subsequently scheduled after wake-up.
The behavior G2D driver for suspend is also applied to shutdown except
the blocked jobs are never scheduled any more.

Change-Id: I2ed215219a2d02dfee507c731d4ed12ac4604eaa
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: cancel jobs running too much time
Cho KyongHo [Sun, 23 Apr 2017 12:26:32 +0000 (21:26 +0900)]
[COMMON] g2d: cancel jobs running too much time

We might face with an unexpected accident that G2D does not complete a
pushed job in a definite time. We should be able to identify that jobs
and to discard them to make the H/W predictable.
We decided 500 milliseconds for the dead-line of the completion of a
job running in the H/W. If H/W does not complete a job in 500 msec.,
The driver kills the job running in H/W and check if it is really
killed. If it is not killed in the next 500 msec., the driver
initializes H/W which means that all the jobs running in H/W are
discarded.

Change-Id: I8119a476bb2e736380031f8277d04caf16baf2ba
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add scheduling to HW
Cho KyongHo [Sun, 23 Apr 2017 08:19:51 +0000 (17:19 +0900)]
[COMMON] g2d: add scheduling to HW

This patch implements pushing a task to H/W and interrupt handler.
Thanks to Job Manager of G2D, it is not required to find a pending
task in tasks_prepared list because a task ready to be scheduled to
H/W is pushed to H/W.

Change-Id: I6cf242009cea87d73d3d715e7312a22dde9062af
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add request the job and schedule
Cho KyongHo [Sun, 23 Apr 2017 07:34:36 +0000 (16:34 +0900)]
[COMMON] g2d: add request the job and schedule

This patch implements the life cycle of a task to G2D. A task has a
completion object to signal the user's request to let it know if its
requested task is completed.
All tasks are pushed to a workqueue that pushes tasks to H/W. It is
required for the tasks that have fences to wait because G2D driver
waits fences asynchronously Because the callback function called when
a fence is signaled is invoked under irq disabled. For the simplicity,
tasks without fences are also pushed to the workqueue because it does
not harm the responsibility to the users seriously.

Change-Id: I3c7ac1cc18212c3ea4b9a22d78a9236ee8491567
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add task management
Cho KyongHo [Fri, 21 Apr 2017 14:28:04 +0000 (23:28 +0900)]
[COMMON] g2d: add task management

G2D driver does not configure SFRs of G2D from the image processing
information from userspace. It just verifies a set of SFR values from
userspace and forwards to H/W the SFR values.
The possible number of SFR values is 830, and H/W limits the number to
1024, we have decided to maintain the pools of the buffers to store
the SFR values from userspace because allocation of 8KB at run-time
may consume a lot of time.
We also decided to create 16 buffers to store the SFR values which is
called 'Command list' because G2D H/W accepts 16 compositing jobs in
maximum.
We call entries in the pool as 'task' and a task has the following
elements:
- JOB ID that is used by H/W to distinguish jobs
- Descriptions of 16 source layers and the target image
- Buffer descriptions of each layer
- Command list

The life time of a task:
A new task is registered to tasks_free list of g2d_device. If a
compositing job is requested by userspace, G2D driver pulls a task
from tasks_free list and configures the task for the requested
compositing. When the configuration is finished, the task is
registered to tasks_prepared list. Therefore all tasks registered to
tasks_prepared are ready to be pushed to H/W. If a task should be wait
for fences to be signaled, it is not registered to tasks_prepared list
until the fence is signaled. As a result, tasks are listed in
tasks_prepared in a very short time except the system is falling into
suspend to RAM. The tasks remained in tasks_prepared are pushed to the
H/W as soon as the system is woken up from supend to RAM.
When H/W completes composting of a pushed task, it is removed from
tasks_active and returned to tasks_free.

The implemetation of the life cycle of tasks is included in the
following patch series.

Change-Id: I38f11020fc27e48c05d05e39ed9dc9ae28f9eb58
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[COMMON] g2d: add skeleton driver
hyesoo.yu [Wed, 5 Apr 2017 13:15:16 +0000 (22:15 +0900)]
[COMMON] g2d: add skeleton driver

FIMG2D driver is just probed with the following initializations:
- A character device node is created under /dev/g2d
- SFR base is remapped and the interrupt handler is registered
- Runtime PM is enabled
- H/W Version is read
- IOMMU is attached

Change-Id: I7af02ef7013bdc90ee8750e4da3d44e01517d1c9
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 months ago[9610][ERD] arm64: dts: change console destination to ram
Youngmin Nam [Thu, 24 May 2018 06:58:22 +0000 (15:58 +0900)]
[9610][ERD] arm64: dts: change console destination to ram

Change-Id: Ifc5d32e14a646dcc567d85305b47b533e87f4bf1
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 months ago[COMMON] scsi: ufs: fix clang warning
JaeHun Jung [Thu, 24 May 2018 06:00:59 +0000 (15:00 +0900)]
[COMMON] scsi: ufs: fix clang warning

This patch resolve below waring.

warning: implicit conversion from 'unsigned long' to 'int' changes
         value from 18446744073709551615 to -1 [-Wconstant-conversion]

Change-Id: I88e9f844dfdbb310eb4bb1a5ac85d14a2eafe53c
Signed-off-by: JaeHun Jung <jh0801.jung@samsung.com>
6 months ago[9610] soc: samsung: cal-if: add volatile keyword to prevent optimization by clang...
Youngmin Nam [Thu, 24 May 2018 02:27:08 +0000 (11:27 +0900)]
[9610] soc: samsung: cal-if: add volatile keyword to prevent optimization by clang compiler

In the CLANG compiler, "pr_info("  mif grp : %d\n", asv_tbl->mif_asv_group);" makes panic as below.

[    0.000000]  [0:      swapper/0:    0] Unable to handle kernel paging request at virtual address ffffff8008015006
[    0.000000]  [0:      swapper/0:    0] Mem abort info:
[    0.000000]  [0:      swapper/0:    0]   Exception class = DABT (current EL), IL = 32 bits
[    0.000000]  [0:      swapper/0:    0]   SET = 0, FnV = 0
[    0.000000]  [0:      swapper/0:    0]   EA = 0, S1PTW = 0
[    0.000000]  [0:      swapper/0:    0] Data abort info:
[    0.000000]  [0:      swapper/0:    0]   ISV = 0, ISS = 0x00000021
[    0.000000]  [0:      swapper/0:    0]   CM = 0, WnR = 0
[    0.000000]  [0:      swapper/0:    0] swapper pgtable: 4k pages, 39-bit VAs, pgd = ffffff8009af1000
[    0.000000]  [0:      swapper/0:    0] [ffffff8008015006] *pgd=00000008fd7fe003, *pud=00000008fd7fe003, *pmd=00000008fd7fd003, *pte=00e8000010009707
[    0.000000]  [0:      swapper/0:    0] Internal error: Oops: 96000021 [#1] PREEMPT SMP
[    0.000000]  [0:      swapper/0:    0] Modules linked in:
[    0.000000]  [0:      swapper/0:    0] debug-snapshot: item - log_kevents is disabled
[    0.000000]  [0:      swapper/0:    0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.32-34884-g2fc291f958c6 #1
[    0.000000]  [0:      swapper/0:    0] Hardware name: Samsung ERD9610 board based on EXYNOS9610 (DT)
[    0.000000]  [0:      swapper/0:    0] task: ffffff8008fd9380 task.stack: ffffff8008fb0000
[    0.000000]  [0:      swapper/0:    0] PC is at asv_table_init+0xcc/0x1b4
[    0.000000]  [0:      swapper/0:    0] LR is at asv_table_init+0xc0/0x1b4
[    0.000000]  [0:      swapper/0:    0] pc : [<ffffff8008447f30>] lr : [<ffffff8008447f24>] pstate: 604000c5
[    0.000000]  [0:      swapper/0:    0] sp : ffffff8008fb3e20
[    0.000000]  [0:      swapper/0:    0] x29: ffffff8008fb3e40 x28: 0000000080bd0018
[    0.000000]  [0:      swapper/0:    0] x27: 0000000000000000 x26: 0000000000000001
[    0.000000]  [0:      swapper/0:    0] x25: ffffff8008fb3f20 x24: dead000000000100
[    0.000000]  [0:      swapper/0:    0] x23: ffffff8008fb3f20 x22: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x21: ffffff8009a6d000 x20: ffffff8009125000
[    0.000000]  [0:      swapper/0:    0] x19: 00e8000000000707 x18: 000000000000186a
[    0.000000]  [0:      swapper/0:    0] x17: ffffff8100d020c8 x16: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x15: 00000000fffffff5 x14: ffffff8009a12000
[    0.000000]  [0:      swapper/0:    0] x13: ffffff8008fd9ca8 x12: 00000000ffffffbf
[    0.000000]  [0:      swapper/0:    0] x11: 0000000000000000 x10: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x9 : b6a063fd53402b00 x8 : ffffff8008015000
[    0.000000]  [0:      swapper/0:    0] x7 : 0000000000000000 x6 : ffffff80081222f8
[    0.000000]  [0:      swapper/0:    0] x5 : 0000000000000000 x4 : 0000000000000080
[    0.000000]  [0:      swapper/0:    0] x3 : ffffff8008fb3a34 x2 : 0000000000000001
[    0.000000]  [0:      swapper/0:    0] x1 : 0000000000000001 x0 : ffffff8008aeccc2

To resolve this issue, we should add volatile keyword to struct variables.

Change-Id: I6e97594253ef04f7b76365fd685aea09446bbd9f
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 months ago[COMMON] ufs: fix build error in clang compiler
hgchu [Mon, 26 Mar 2018 02:27:05 +0000 (11:27 +0900)]
[COMMON] ufs: fix build error in clang compiler

Equality comparison with extraneous parentheses error fixed.

Change-Id: Iae6545f83d379080a7ebe5a414481bed6f8bd5ff
Signed-off-by: hgchu <hg.chu@samsung.com>
6 months ago[9610][ERD] arm64: configs: disable CONFIG_PHONET
Youngmin Nam [Wed, 23 May 2018 04:50:56 +0000 (13:50 +0900)]
[9610][ERD] arm64: configs: disable CONFIG_PHONET

This patch disables CONFIG_PHONET to resolve build warning
in case of clang build

Change-Id: I1f84231be5b80131ccb23afb57f7de2776017237
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
6 months ago[COMMON] soc: samsung: Add EXYNOS_SDM to Kconfig
Keunyoung Park [Thu, 5 Apr 2018 02:12:15 +0000 (11:12 +0900)]
[COMMON] soc: samsung: Add EXYNOS_SDM to Kconfig

Change-Id: I15843f08b30b342e2b7d81951484449d0b78c7f6
Signed-off-by: Keunyoung Park <keun0.park@samsung.com>
6 months ago[COMMON] soc: samsung: add codes for Security Dump Manager
Keunyoung Park [Thu, 5 Apr 2018 02:11:16 +0000 (11:11 +0900)]
[COMMON] soc: samsung: add codes for Security Dump Manager

Change-Id: I9863edba61b8f35c0407f809ab03abab9ea61d63
Signed-off-by: Keunyoung Park <keun0.park@samsung.com>