Commit Graph

215 Commits

Author SHA1 Message Date
2f62484e84 MLK-19493 gpu: imx: dpu: tcon: Tune kachuck from slave
As suggested by designer for safety's sake, this patch tunes
kachuck from slave tcon to generate it 2 lines later than
master tcon.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:48 +08:00
1fad0c7ba4 MLK-19468: drm: imx: dcss: fix blkctl setting for B1 silicon
B1 silicon has a new ID and we need to handle it properly.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:33:47 +08:00
e5b206afce MLK-19413-27 gpu: imx: dpu: extdst: Add extdst_pixengcfg_syncmode_master() helper
This patch adds extdst_pixengcfg_syncmode_master() helper support
so that the callers may control if a extdst is master or slave
when it works in sync mode.  The bit16 of extdst's PIXENGCFG_STATIC
register controls this and it's a part of sync mode fixup logic.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:44 +08:00
c27a83bd43 MLK-19413-26 gpu: imx: dpu: framegen: Support two helpers for secondary syncup status
This patch adds framegen_secondary_is_syncup() and
framegen_wait_for_secondary_syncup() helpers support so that
the callers may know a framegen's syncup status for the
secondary input.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:44 +08:00
79da4eedff MLK-19413-25 gpu: imx: dpu: framegen: Add framegen_syncmode_fixup() helper
Bit7 of framegen's SECSTATCONFIG register is used to control
the sync mode fixup logic implemented in framegen.  This patch
adds framegen_syncmode_fixup() helper so that the callers
may enable/disable the fixup logic for a framegen.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:44 +08:00
82b37cf82e MLK-19413-24 gpu: imx: dpu: common: Add store9 support for sync mode fixup
Bit16 of store9's PIXENGCFG_STATIC register is used to control
the sync mode fixup logic implemented in store9.  So, let's
add store9 support in the DPU core driver and export a function
for users to enable/disable the fixup logic.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
2a1e654f53 MLK-19413-23 gpu: imx: dpu: Add constframe_framedimenstions_copy_prim() helper support
This patch adds constframe_framedimenstions_copy_prim() helper support
so that callers may may copy frame dimensions from a primary constframe
to the relevant secondary constframe.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
2192e34d67 MLK-19413-22 gpu: imx: dpu: Add pixel combiner support
This patch adds pixel combiner support in the DPU core driver.
Users may get and enable/disable/control a pixel combiner instant
via tcon functions and may tell if pixel combiner is available for
a particular DPU variant via the dpu_has_pc() helper and if it is
needed in a specific usecase via the dpu_get_syncmode_min_prate()
and dpu_get_singlemode_max_width() helpers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
c6aa9784ed MLK-19413-19 gpu: imx: dpu: framegen: Do not warn on zero pclk rate for slave framegen
The pixel clock of the slave framegen comes from the master framegen
when the two framegens work in sync mode, so we cannot get pixel clock
from the pixel clock rate from the slave framegen directly to calculate
the timeout value when waiting for it's done.  Instead, we can tell
the rate from the video mode.  So, we take this fallback way to get
the rate in this case and don't warn.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
9a169f8229 MLK-19413-18 gpu: imx: tcon: Add side-by-side support
This patch adds side-by-side support for tcon so that
two tcons can participate in the dual display streams
to work with pixel combiner to drive a high pixel rate
display.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
aacb8b4de8 MLK-19413-17 gpu: imx: dpu: framegen: Add side-by-side support
This patch adds side-by-side support for framegen so that
two framegens can work in sync mode to participate in the
dual display streams to drive a high pixel rate display
via a pixel combiner.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
aaa7105bba MLK-19413-16 gpu: imx: dpu: tcon: Add tcon_is_master/slave() helpers support
This patch adds tcon_is_master/slave() helpers support so that
callers may know if a tcon is a master or slave tcon.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
ff6b46fc38 MLK-19413-15 gpu: imx: dpu: extdst: Add extdst_is_master() helper support
This patch adds extdst_is_master() helper support so that
callers may know if a extdst is a master extdst or not.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:43 +08:00
d066f86071 MLK-19413-14 gpu: imx: dpu: framegen: Add framegen_is_master/slave() helper support
This patch adds framegen_is_master/slave() helpers support so that
callers may know if a framegen is a master or slave framegen.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
d0b812adde MLK-19413-13 gpu: imx: dpu: common: Specify has_syncmode_fixup flag for DPU variants
This patch introduces a new has_syncmode_fixup entry in struct dpu_devtype and
specifies this flag for DPU variants found in existing SoCs.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
6c3b676979 MLK-19413-12 gpu: imx: dpu: framegen: Add helper framegen_syncmode() support
This patch adds helper framegen_syncmode() support so that callers may
control the sync mode of a framegen.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
72b7950239 MLK-19413-11 gpu: imx: dpu: common: Add di_grp_id in display client pdev's data
This patch adds a new di_grp_id entry in display client pdev's data
so that the relevant display platform driver may know the display
group ID of the display device.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
d84d03e5fa MLK-19413-10 gpu: imx: dpu: Add helpers to peek at auxiliary display submodules
This patch adds dpu_aux_{unit}_peek() helpers so that callers
may peek at auxiliary display submodules.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
2d744901e4 MLK-19413-9 gpu: imx: dpu: Kconfig: Select IMX8_PC
This patch selects IMX8_PC when DPU core is enabled.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
ad8c7e0af2 MLK-19413-8 gpu: imx: Add imx8 pixel combiner support
This patch adds i.MX8 pixel combiner driver support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:42 +08:00
7cd5df6ddc MLK-19411 gpu: imx: dpu: units: Fix bailout path of dpu_*_get()
If a DPU unit is already in use, the bailout path of dpu_{unit}_get()
would wrongly dereference the pointer of ERR_PTR(-EBUSY).  This patch
fixes this issue.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:33:39 +08:00
b745eb50cf MLK-19242 gpu: imx: dpu: framegen: Increase timeout when waiting for moving
It takes 33 milliseconds to scanout a frame when display refresh rate
is 30fps, and 42 milliseconds for 24fps.  So, if we wait for framegen
frame index moving, 30 milliseconds timeout value is not enough to
cover all reasonable display refresh rates.  50 milliseconds should not
be a bad choice.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 8564546882)
2019-02-12 10:33:35 +08:00
d0796bff82 MLK-19114-2 gpu: imx: imx8-prefetch: Remove has_prefetech_fixup from devtypes
There are prefetch engine fixups embedded in the updated i.MX8QM silicons.
So, prefetch engines in all i.MX8 variants should be the same.  Let's
remove has_prefetech_fixup from devtypes which is no more needed.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 875c31a70f)
2019-02-12 10:33:34 +08:00
b606666106 MLK-18992-1 gpu: imx: dpu: framegen: Explicitly set pixel link MST address
The framegen driver knows the encoder type, so it may set pixel link
MST address according to the type.  The MST address for the TMDS encoder
is special, while the address is zero for other encoders.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit fb3e63cce0)
2019-02-12 10:33:34 +08:00
acc2114a8a MLK-18990 gpu: imx: dpu: framegen: Don't set clk_disp rate for TMDS encoder
When TMDS encoder is used, the encoder would provide framegen display clock
directly via clk_bypass.  So, we don't have to set clk_disp rate.  This
should work with or without pixel combiner(pixel combiner would combine
two framegens' output to drive high pixel rate displays via TMDS encoder
only currently).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 4b710fe10f)
2019-02-12 10:33:34 +08:00
d64ff2b2f6 MLK-19274: drm: imx: dcss: add rotation functionality
This patch will allow userspace to rotate planes by setting the
'rotation' property. Generally, 0 and 180 rotations are allowed for
pretty much all 8-bit xRGB and 2-plane YUV420 formats. 90/270 rotations
can be performed only for non-compressed tiled GPU xRGB formats. Tiled
YUV420 formats do not allow rotations at all because these formats need
DTRC for de-tiling and DTRC has no rotation support.

For more info, consult the DPR Features chapter in the reference manual.

Test example:

modetest -M imx-drm -w 27:rotation:4 -w 32:rotation:33 -w 27:alpha:30 -s
42@31:3840x2160-60@XR24 -P 32@31:3840x2160@NV21

The above will perform:
 * 180 degree rotation of primary plane (XR24);
 * vertical flip of first overlay plane (rotate-0 | reflect-y);
 * set primary plane alpha to 30;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:33:29 +08:00
f16eac4a32 MLK-19158-3 gpu: imx: lcdif: fix output order for 16bpp BGR formats
The 16bpp BGR order pixel formats 'DRM_FORMAT_ABGR1555' and
'DRM_FORMAT_XBGR1555' also require to be re-ordered to RGB
order for display, just like the format 'DRM_FORMAT_BGR565'
does.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f5cc4f4699570fe697d21cb47c54aa91b82c8458)
2019-02-12 10:33:19 +08:00
a5940ee5db MLK-19158-2 drm/imx: lcdif: improve output bus format config
According to LCDIF specification, the input pixel data
width and the output pixel data width can be different,
and this conversion is done by LCDIF automatically. So
config the output data width according to the requested
bus format from the encoder, instead to be same with the
input pixel data width.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit bfd27f6d71d86a7f2fc8314f082565db3682b925)
2019-02-12 10:33:19 +08:00
55a2e07dd5 MLK-19152-1 gpu: imx: lcdif: realize fb horizontal crop via Pigeon Mode
According to the LCDIF specification, the Legacy Mode does not
support cropping function in the horizontal direction, so add
Pigeon Mode which can support this kind of function. And when
enable this mode, the legacy horizontal timings configuration
should use stride value but not the active width, and related
pigeon configuration should use the active width but not the
stride value.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit e6da9542693dd585972897f62748a101f5726a74)
2019-02-12 10:33:07 +08:00
909a7d1860 MLK-19112 gpu: imx: lcdif: change 'rpm_suspended' to be atomic counter
Change the 'rpm_suspended' field to be an atomic type from
boolean type to make it have the counting ability which can
help to detect and avoid runtime suspend and resume calls
mismatch caused problems.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit dece6fbe51f9c0ea3cd42c52e1c174bd26ae70f1)
2019-02-12 10:33:05 +08:00
defd91c3c0 MLK-19017-4 gpu: imx: lcdif: add rpm status check for suspend/resume
Add runtime PM status check during runtime suspend and resume
to avoid unnecessary jobs if it is already in that state which
can avoid below kernel warnings during system suspend if it is
alreay in runtime suspended state:

[   21.772969] ------------[ cut here ]------------
[   21.772982] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:594 clk_core_disable+0x80/0x88
[   21.772986] Modules linked in:
[   21.772988]
[   21.772993] CPU: 3 PID: 3328 Comm: rtcwakeup.out Not tainted 4.9.88-05410-g9fa23e9ada2a #135
[   21.772995] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.772997] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773000] PC is at clk_core_disable+0x80/0x88
[   21.773003] LR is at clk_core_disable_lock+0x20/0x34
[   21.773005] pc : [<ffff0000084e1430>] lr : [<ffff0000084e1a5c>] pstate: 800001c5
[   21.773007] sp : ffff80007b40fa90
[   21.773010] x29: ffff80007b40fa90 x28: 0000000000000000
[   21.773014] x27: 0000000000000002 x26: ffff000009395000
[   21.773017] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773021] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773024] x21: ffff00000862877c x20: ffff80007a049400
[   21.773027] x19: 0000000000000140 x18: 0000000000000002
[   21.773031] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773034] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773037] x13: 0000000000000000 x12: 0000000000000000
[   21.773040] x11: 0000000000000000 x10: 0000000000000000
[   21.773044] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773047] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773051] x5 : ffff80007a53f9a8 x4 : 0000000000000000
[   21.773054] x3 : 0000000010c110c0 x2 : 0000000000000000
[   21.773057] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773058]
[   21.773060] ---[ end trace 4a8e187491f145ed ]---
[   21.773062] Call trace:
[   21.773065] Exception stack(0xffff80007b40f8b0 to 0xffff80007b40f9e0)
[   21.773068] f8a0:                                   0000000000000140 0000ffffffffffff
[   21.773071] f8c0: ffff80007b40fa90 ffff0000084e1430 00000000800001c5 000000000000003d
[   21.773074] f8e0: ffff80007b475c00 ffff80007b40c000 ffff80007b40c000 000000018020001e
[   21.773077] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773081] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773084] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773087] f960: ffff80007a049400 0000000000000000 0000000000000000 0000000010c110c0
[   21.773090] f980: 0000000000000000 ffff80007a53f9a8 0010ed7f00000000 0000000000000000
[   21.773092] f9a0: 0000000000210d00 0000000040000000 0000000000000000 0000000000000000
[   21.773095] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000463fe3000000
[   21.773098] [<ffff0000084e1430>] clk_core_disable+0x80/0x88
[   21.773101] [<ffff0000084e1a5c>] clk_core_disable_lock+0x20/0x34
[   21.773104] [<ffff0000084e1a8c>] clk_disable+0x1c/0x24
[   21.773110] [<ffff0000085c73a0>] lcdif_disable_clocks+0x1c/0x60
[   21.773113] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773118] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773123] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773126] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773129] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773132] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773137] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773139] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773142] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773147] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773153] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773156] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773160] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773163] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773166] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773170] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4
[   21.773184] ------------[ cut here ]------------
[   21.773188] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:476 clk_core_unprepare+0x88/0x98
[   21.773190] Modules linked in:
[   21.773192]
[   21.773195] CPU: 3 PID: 3328 Comm: rtcwakeup.out Tainted: G        W       4.9.88-05410-g9fa23e9ada2a #135
[   21.773196] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.773198] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773201] PC is at clk_core_unprepare+0x88/0x98
[   21.773204] LR is at clk_unprepare+0x28/0x34
[   21.773206] pc : [<ffff0000084e1320>] lr : [<ffff0000084e3130>] pstate: 60000145
[   21.773208] sp : ffff80007b40faa0
[   21.773211] x29: ffff80007b40faa0 x28: 0000000000000000
[   21.773215] x27: 0000000000000002 x26: ffff000009395000
[   21.773218] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773221] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773225] x21: ffff00000862877c x20: ffff80007aafbf80
[   21.773228] x19: ffff80007aafb298 x18: 0000000000000002
[   21.773232] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773235] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773238] x13: 0000000000000000 x12: 0000000000000000
[   21.773241] x11: 0000000000000000 x10: 0000000000000000
[   21.773245] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773248] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773251] x5 : ffff80007a53f9a8 x4 : ffff00000944b000
[   21.773255] x3 : 0000000000000000 x2 : ffff800074358c80
[   21.773258] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773259]
[   21.773260] ---[ end trace 4a8e187491f145ee ]---
[   21.773262] Call trace:
[   21.773264] Exception stack(0xffff80007b40f8c0 to 0xffff80007b40f9f0)
[   21.773267] f8c0: ffff80007aafb298 0000ffffffffffff ffff80007b40faa0 ffff0000084e1320
[   21.773270] f8e0: 0000000060000145 000000000000003d ffff80007b40c000 000000018020001e
[   21.773273] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773276] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773279] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773282] f960: ffff80007a049400 0000000000000000 ffff80007a049400 0000000000000000
[   21.773285] f980: ffff800074358c80 0000000000000000 ffff00000944b000 ffff80007a53f9a8
[   21.773288] f9a0: 0010ed7f00000000 0000000000000000 0000000000210d00 0000000040000000
[   21.773291] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.773293] f9e0: 0000000000000000 0000463fe3000000
[   21.773296] [<ffff0000084e1320>] clk_core_unprepare+0x88/0x98
[   21.773299] [<ffff0000084e3130>] clk_unprepare+0x28/0x34
[   21.773303] [<ffff0000085c73a8>] lcdif_disable_clocks+0x24/0x60
[   21.773306] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773309] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773312] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773315] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773318] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773321] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773324] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773327] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773329] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773332] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773336] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773339] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773342] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773345] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773347] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773350] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a6bac9bdebbdecf56575f6e361ad8f54e5263b95)
2019-02-12 10:33:01 +08:00
ad367beb84 MLK-19017-3 gpu: imx: add system pm support for LCDIF
Implement the suspend()/resume() callbacks to support system
power management functions for LCDIF.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7e00487012753cb370eab4ff5c05f76f7361297f)
2019-02-12 10:33:01 +08:00
aa6a8be1f5 MLK-19017-2 gpu: imx: add DISPMIX power domain support for LCDIF
After the DISPMIX power domain enabled, all the related registers
will drop their values once runtime pm suspend called. So in the
pm runtime resume process, the LCDIF de-reset and some init jobs
need to be done, and these jobs are no longer necessary to be done
during probe stage anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f83aaaecaeb54d8b1231be2cb7175ce58682dae7)
2019-02-12 10:33:01 +08:00
855dea4f35 MLK-18809: drm: imx: dcss: revert the max upscale ratio to 1:8
The DCSS RM states that the maximum upscale ratio is 1:8. However, DCSS
HW team suggested some time back that upscale ratios of 1:16 could be
achieved with DCSS scaler, though these ratios were not validated.

Unfortunately there are corner cases, when the upscale ratio nears
1:16, that fail. At the recommendation of DCSS designers, we revert the
maximum ratio to 1:8 until further notice.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
(cherry picked from commit bafb5a9481c289951872923d4bbbbcf24a8910b5)
2019-02-12 10:32:57 +08:00
133855b90b MLK-18826: drm: imx: dcss: fix hang when dumping registers
If DCSS is suspended, the clocks are disabled. Dumping the registers,
with the following command:

cat /sys/kernel/debug/imx-dcss/dump_registers

will hang the system, because of DTG.

This patch makes sure clocks are enabled before dumping the registers
and will immediately release them afterwards.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:44 +08:00
18d6c486e4 MLK-18873: drm: imx: dcss: request PM QoS only when VBLANK is on
DCSS needs PM QoS in order to keep interrupt latency low. Otherwise,
page flipping will not work smooth enough because CTXLD will not be
triggered in time.

Currently, PM QoS is requested all the time but that does not allow the
CPUs to go idle. Hence, this leads to increased power consumption.

This patch will change how PM QoS is requested by doing it only when
VBLANK is enabled/disabled. The VBLANK interrupt is enabled just before
a commit takes place and disabled after one second after last commit.
This will allow DCSS to function properly and, also, allow CPUs to go
idle whenever there's no buffer submitted.

Exception to this is when DTRC is used (when DCSS is passed tiled
buffers). In this case, PM QoS will always be active, even if no buffer
is submitted, because DTRC banks need to be switched in CTXLD ISR, so
that DCSS does not underrun. DTRC does not have the REPEAT feature, as
the rest of DCSS does.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:39 +08:00
0582cd50ed MGS-4061 gpu: imx: dpu-blit: fix kernel panic in pm test
resume will increase unlock counter, max allowed value is 15.
suspend need decrease unlock counter to avoid overflow panic.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-02-12 10:32:36 +08:00
01514db138 MGS-4051 gpu: imx: dpu-blit: fix suspend resume issue
suspend & resume will destory and recreate blitter,
reset dprc start flags in blitter initialization.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-02-12 10:32:35 +08:00
7f8239c878 MLK-18844: drm: imx: dcss: lower mode change time
Currently, there's a hardcoded wait time (500ms) after enabling DTG
clocks. This is supposed to avoid VBLANK timeout warning messages.
However, this time is quite big. This patch changes this by lowering this
time as much as possible, with the use of completion events. After
enabling CRTC we just block until the first VBLANK interrupt comes. This
way, we know for sure that we'll never get a VBLANK timeout.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:29 +08:00
3f77069897 MLK-18680-4: drm: imx: dcss: activate DPR completion interrupts
This patch activates DPR completion interrupts, just for tracing and
detecting green screen issues.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:28 +08:00
fd26cac133 MLK-18680-3: drm: imx: dcss: activate DTRC interrupts for debugging
DTRC interrupts will not be used for switching the banks, as the CTXLD
will be used for that, however these are useful for tracing and
debugging green screen issues when DTRC is used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:28 +08:00
4f7b9db981 MLK-18680-2: drm: imx: dcss: add some traces
This patch will add traces for the following events:
 * CTXLD arm, completion and kick;
 * VBLANKs;
 * atomic flushes;
 * plane updates (printing the DPR buffer base address);

These will allow us to measure and analyze where bottlenecks are:
application or driver.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:28 +08:00
cbf778aa33 MLK-18680-1: drm: imx: dcss: low latency tracing mechanism
This patch adds a DCSS tracing mechanism that introduces as low latency
as possible, so that it does not affect timings. Instead of text, 64 bit
tags will be logged, together with the system time in nanoseconds. Based
on these, post-processing can be done on any PC to compute deltas,
delays, missed buffers, etc.

Example usage:

echo 1 > /sys/module/imx_dcss_core/parameters/tracing
gplay-1.0 movie.mpg
echo 0 > /sys/module/imx_dcss_core/parameters/tracing

To dump the trace:
cat /sys/kernel/debug/imx-dcss/dump_trace_log > trace.txt

With the help of a scripting language (awk), the trace can then be
post-processed and analyzed on the PC.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:28 +08:00
00d05efa64 MGS-3560 [#imx-913] Enable DRM compression for mscale board
Refine the code for compressed format support.

Date: June 29, 2018
Signed-off-by: Yong Gan <yong.gan@nxp.com>
2019-02-12 10:32:27 +08:00
7ad6072a37 MLK-17925: drm: imx: dcss: fix tearing
The video tearing appeared only when the application used 2 buffers.
That's because, sometimes, the context loader could be armed after the
DB event came in the frame trace. That made a buffer submitted in frame
N end up on screen in frame N+2 because the context loader waits for the
next DB event. Since vblank events are sent at the end of the frame, by
the time the buffer lands on screen, the application will reuse it while
it's being displayed, hence the tearing effect.

This patch moves the CTXLD trigger moment all the way to the end of the
frame trace, just before DB event arrives. This will leave the
application plenty of time to submit new buffers.

In the event that the trigger moment is missed (application submits a
buffer right at the end of a frame trace), then we're not signalling the
next VBLANK event to application. This way, application will know that
the buffer is still needed and will not submit a new one.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-02-12 10:32:15 +08:00
3b6fc6c957 MLK-18576-3 drm/imx: ldb: Add dual channel mode support for i.MX8dx/dxp/qxp
i.MX8dx/dxp/qxp use two LDBs(one primary, one auxiliary) to support
dual channel mode.  This patch adds the dual channel mode support
for i.MX8dx/dxp/qxp.  Note that the drivers contain specific sequence
needed by this mode - LDB VSYNC polarity and channel selection settings
should be configured into the register a bit earlier in ->atomic_mode_set
instead of in ->enable, and DC subsystem pixel link enablement is moved
from the DPU driver to the LDB driver to make sure it happens later
than LDB clocks enablement in ->enable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:32:11 +08:00
f1d0c89ec4 MLK-18560 drm/imx: lcdif: refine bus format sanity check for plane
Add an function to get the LCDIF controller supported bus
formats according to the pixel format bpp. And change the
bus format sanity check in the plane's atomic check to see
if the bus format required by the peripheral attached to
LCDIF can be supported by LCDIF.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-02-12 10:32:10 +08:00
e84e499993 MGS-3940-3 gpu: imx: dpu-blit: fix the confusable logic
Simplify the code to sync command sequncer in conditions:
1. tile work with dprc/prg (baddr)
2. switch tile to linear (!start)

revert 686c717fef
MLK-18398 gpu: imx: imx8_dprc: dpu-blit: Wait the dprc idle before
disable it

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-02-12 10:32:07 +08:00
a409471117 MGS-3940-2 gpu: imx: dpu-blit: fix event trigger
the previous programming does not flush command sequence,
that cause the obvious flicker when run glmark2 in full-screen,
also the wrong logic cause wayland hang in strict conditions.

need program event trigger to sync command sequencer properly.
also revert workaround: 4767f9aaad
MLK-18283-3 gpu: imx: dpu-blit: sync for cmd sequence finished

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-02-12 10:32:07 +08:00
335458cf90 MGS-3940-1 gpu: imx: dpu-blit: fix first frame handler
chrome browser hang is reproduced with mouse connected,
the first frame handler trigger the problem in below scenario:
tile (dprc-enable) --> linear (dprc->disable) --> tile (handle first frame wrongly).

need_handle_start is set following dprc_enable, need reset it with dprc_disable.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-02-12 10:32:06 +08:00