Commit Graph

104 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
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
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
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
79191710d0 MLK-18477-2 gpu: imx: dpu: framegen: Explicitly use bypass clk for TMDS encoder
The framegen driver should get PLL clock, bypass clock and display
selection/mux clock via device tree if available.  It may use bypass
clock when a TMDS encoder is connected with the framegen, otherwise,
PLL clock is used.  This way, the assigned-clocks and assigned-clock-parents
device tree properties can be removed from the dpu device tree node.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:32:00 +08:00
7cfcb8f70e MLK-18347 gpu: imx: dpu: Correct baddr and stride for PRG x/y offset
We use PRG x/y offset to do in-micro-tile cropping for new DPR/PRG IPs.
When tile resolving is enabled by using the new IPs, the design team
indicates that DPU fetch unit base address and DPU/PRG stride need to be
calculated in the below steps:

1) prg_Baddr = dpr_Baddr
2) tmp_dpu_Baddr = prg_Baddr + prg_x_offset * bytes_per_pixel
3) tmp_burst_size = 1 << (ffs(tmp_dpu_Baddr) - 1)
   tmp_burst_size = round_up(tmp_burst_size, 8)
   burst_size = min(tmp_burst_size, 128)
4) tmp_dpu_stride = dpu_width * bytes_per_pixel
5) dpu_stride =
	round_up(tmp_dpu_stride + round_up(tmp_dpu_Baddr % 8, 8), burst_size)
6) dpu_Baddr = tmp_dpu_Baddr + prg_y_offset * dpu_stride
7) prg_stride = dpu_stride

The legacy DPR/PRG IPs and linear formats driver logic should not be
essentially touched.

This patch implements the above calculation method in the drivers
so that all valid in-micro-tile x/y cropping arguments can be supported.
Without this, at least, some cropping cases with odd x value would fail.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:57 +08:00
a7d6e82d88 MLK-18229-4 gpu: imx: dpu: fetchwarp: Cosmetic changes on fw_ops entries
This patch contains cosmetic changes on fw_ops entries to make the
entries be more readable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:38 +08:00
46ed2f5df9 MLK-18229-3 gpu: imx: dpu: fetchdlayer: Cosmetic changes on fl_ops entries
This patch contains cosmetic changes on fl_ops entries to make the
entries be more readable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:37 +08:00
188aaad6ed MLK-18229-2 gpu: imx: dpu: fetcheco: Cosmetic changes on fe_ops entries
This patch contains cosmetic changes on fe_ops entries to make the
entries be more readable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:37 +08:00
42748216a8 MLK-18229-1 gpu: imx: dpu: fetchdecode: Cosmetic changes on fd_ops entries
This patch contains cosmetic changes on fd_ops entries to make the
entries be more readable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:37 +08:00
3c152440b3 MLK-18207 gpu: imx: framegen: Remove redundant pll and display clk rate get
We get pll and display clock rates twice in framegen_cfg_videomode().
This patch removes the redundant code so that the rates are got once.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:37 +08:00
231f0254ee MLK-18211 gpu: imx: layerblend: Zero sec alpha when sec input is from scaler
It turns out that local alpha value of the secondary input is set to
0xFF by the hardware if the secondary input is from scaler(hscaler or
vscaler).  This makes the layer on this secondary input accidentally
cover the layer with higher z-order(if it exists), even though the
layer with lower z-order doesn't supply local alpha.  This patch zeros
the secondary local alpha value to prevent the issue from happening.
Users are unlikely to expect local alpha to be correctly scaled, so
it looks fine to simply zero the alpha.  If we find the unlikely case,
the KMS driver may later explicitly do atomic check to invalidate the case.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:37 +08:00
fb7530de79 MLK-18195 gpu: imx: dpu: framegen: Correct PLL rate to get proper pclk rate
This patch corrects pixel clock PLL rate calculation.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
2019-02-12 10:31:36 +08:00
d01a3668f3 MLK-18162 gpu: imx: dpu: Abstract fetch unit concept
This patch abstracts fetch unit concept for all the fetch units
we have - fetchdecode, fetcheco, fetchlayer and fetchwarp.
They have some similar features and operations which are suitable
to be abstracted.  A lot of boilerplate code is removed.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:30 +08:00
d6b69aa741 MLK-18012-2 gpu: imx: dpu: layerblend: Change alpha blend settings
This patch changes layerblend alpha blend settings so that
the layerblend reads local alpha value from the primary
input to blend color components and generates alpha values
from the secondary input for the layer with the lowest zorder.
This makes KMS support local alpha for the primary DRM plane.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:15 +08:00
34035dcdc9 MLK-18012-1 gpu: imx: dpu: Add 32bpp local alpha RGB pfmt definitions
This patch adds 32bpp local alpha RGB pixel format definitions
into the dpu_pixel_format_matrix array.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:15 +08:00
af38948ecb MLK-18009 drm/imx: dpu: plane: Support deinterlacing via fetchdecode & vscaler
Fetchdecode may work together with vscaler to do bob deinterlacing.
This patch adds the deinterlacing support for DPU DRM plane by using them.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:14 +08:00
8dd9c0a7e3 MLK-17931-3 gpu: imx: dpu: common: Add dpu_has_prefetch_fixup() helper support
This patch adds dpu_has_prefetch_fixup() helper support.
Users may use it to tell if a DPU has fixups for prefetch
engines in silicon or not.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:14 +08:00
12fa2b4b54 MLK-17931-2 gpu: imx: dpu: common: Differentiate DPUs w/wo DPR fixups
DPR may prefetch linear frames and resolve tile frames for DPU.
New i.MX8QXP SoCs have DPR fixups in silicon.
This patch differentiates DPUs with or without DPR fixups
via OF device ID's data.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:14 +08:00
e579d0c204 MLK-17991-7 drm/imx: dpu: kms: Add basic fetchwarp2 support
This patch adds the first subsidiary layer0(out of layer0 to layer7)
support for the fetchwarp2 fetch unit to be the backend of DRM plane.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:12 +08:00
b9f21d58b9 MLK-17991-5 gpu: imx: dpu: common: Add basic fetchwarp2 support
Fetchwarp is a type of dpu fetch unit with the additional
warping function.  Each fetchwarp contains 8 subsidiary layers.
Fetchwarp2 can work with fetcheco2 to fetch planar YUV pixel
formats.  Also, it may fetch RGB pixel formats.  This patch
adds basic fetchwarp2 fetch unit support in the dpu common driver
so that it may fetch frames in RGB pixel formats.  YUV pixel formats
and warping function could be supported later.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:12 +08:00
467edf03a9 MLK-17991-4 drm/imx: dpu: kms: Add basic fetchlayer0/1 support
This patch adds the first subsidiary layer0(out of layer0 to layer7)
support for the fetchlayer0/1 fetch units to be the backend of DRM plane.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:12 +08:00
0098f265d5 MLK-17991-2 gpu: imx: dpu: common: Add some prefetch engine helpers support
This patch adds some prefetch engine helpers support
in the dpu common driver so that callers may deal with
the prefetch engines of the fetch units the callers
are interested in.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:12 +08:00
93d7400ab1 MLK-17991-1 gpu: imx: dpu: common: Add basic fetchlayer0/1 support
Fetchlayer is a type of dpu fetch unit.  Each fetchlayer
contains 8 subsidiary layers.  Fetchlayer cannot work with
fetcheco to fetch planar YUV pixel formats.  However, it may
fetch RGB pixel formats.  This patch adds basic fetchlayer0/1
fetch units support in the dpu common driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:12 +08:00
f70bfac1b1 MLK-17923 drm/imx: dpu: plane: Do not support fb x/y src offset for tile fmts
We don't have correct support for fb x/y source offset for tile formats.
The buffer address calculation is wrong when the offset is non-zero.
Also, finer offset needs a fix in silicon(TKT344978).  So, let's do not
support the offset currently.  We may add it back after we figure out
how the updated silicon supports the offset.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:31:07 +08:00
f679a03fca MLK-17803 drm/imx: dpu: kms: Correct the way to do DPR manual/auto mode switch
The DPR works in manual mode for the first frame and we need to
switch it to auto mode so that auto shadow load mechanism works.
The designers require us to switch the DPR manual mode to auto mode
directly for display controllers instead of using the DPR control
done irq handler, because the irq will not come in some cases(which
leads to shadow load failure).  Finer switch operations on DPR
register bits are needed for SW_SHADOW_LOAD_SEL, SHADOW_LOAD_EN,
RUN_EN and REPEAT_EN.  Also, for overlay planes, we need to wait for
a frame additionally in the "on-the-fly" cases to make sure the
switch is successful.  In all, this patch should be able to address
frame dropping and screen tearing issue(due to the shadow load
failure) when users play video on overlay planes.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:30:59 +08:00
0dcce7af25 MLK-17371 gpu: imx: dpu: framegen: Use better timeout value to wait for ENSTS
The DPU spec tells us that we need to wait for all pending frames to
be completed when a display stream is disabled.  It turns out
that the hardcoded 60-microsecond timeout value is not enough for
some low refresh rate video modes, e.g., 1920x1080@24, which makes
the display stream be disabled incorrectly(leave the hardware an
incorrect machine status).  The SoC design indicates that there are
two pending frames to complete in the worst case.  This patch waits
for at most three frame duration(which is enough for sure) so that
the hardware may flush out all the pending frames.  In case the clock
subsystem provides us a pixel clock with wrong rate and causes the
timeout value be unreasonably long, we truncate it to wait for at
most three seconds.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:30:11 +08:00
5ee5a41f9f MLK-17311-1 gpu: imx: dpu: common: Set SC_C_KACHUNK_CNT as 32
The SC_C_KACHUNK_CNT is for dpu blit and represents
how many cycle counts is need to trigger DPR after
DPU shadow being loaded. The initial value is 0x20,
and will change to 0 after the first frame if not set.
So it need be set with a value greater than 0x20.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
2019-02-12 10:30:07 +08:00
cf79688d8a MLK-15110-22 drm/imx: dpu: crtc: Evade the first dumb frame for DPR/PRG errata
To workaround the errata TKT320950, DPR/PRG need to evade the first dumb frame
which is generated by DPU.  The way we achieve that is to bypass TCON(but set
the TCON sync signals and KA_CHUCK strobe signal up) before enabling the DPU
display controller, and then enable the display controller, wait for the frame
index starting to move and finally switch TCON to operation mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:29:49 +08:00
4fc2092667 MLK-15110-21 gpu: imx: dpu: framegen: Add timestamp support for frame index
This patch adds framegen timestamp support for the frame index feature.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-02-12 10:29:48 +08:00