mbox series

[v13,0/6] drm/imx: Introduce i.MX8qm/qxp DPU DRM

Message ID 20221019020226.2340782-1-victor.liu@nxp.com (mailing list archive)
Headers show
Series drm/imx: Introduce i.MX8qm/qxp DPU DRM | expand

Message

Liu Ying Oct. 19, 2022, 2:02 a.m. UTC
Hi,


This is the v13 series to introduce i.MX8qm/qxp Display Processing Unit(DPU)
DRM support.

DPU is comprised of a blit engine for 2D graphics, a display controller
and a command sequencer.  Outside of DPU, optional prefetch engines can
fetch data from memory prior to some DPU fetchunits of blit engine and
display controller.  The pre-fetchers support linear formats and Vivante
GPU tile formats.

Reference manual can be found at:
https://www.nxp.com/webapp/Download?colCode=IMX8DQXPRM


This patch set adds kernel modesetting support for the display controller part.
It supports two CRTCs per display controller, several planes, prefetch
engines and some properties of CRTC and plane.  Currently, the registers of
the controller is accessed without command sequencer involved, instead just by
using CPU.  DRM connectors would be created from the DPU KMS driver.


Patch 1 ~ 3 add dt-bindings for DPU and prefetch engines.
Patch 4 is a minor improvement of a macro to suppress warning as the KMS driver
uses it.
Patch 5 introduces the DPU DRM support.
Patch 6 updates MAINTAINERS.

Welcome comments, thanks.

v12->v13:
* Drop 'drm->irq_enabled = true;' from patch 5/6 to fix a potential build
  break reported by 'kernel test robot <lkp@intel.com>'.  drm->irq_enabled
  should not be used by imx-dpu drm as it is only used by legacy drivers
  with userspace modesetting.

v11->v12:
* Rebase the series upon v6.1-rc1.
* Minor update on Kconfigs, struct names and macro names for patch 5/6
  due to the rebase.

v10->v11:
* Rebase the series upon v6.0-rc1.
* Include drm_blend.h and drm_framebuffer.h in dpu-kms.c and dpu-plane.c
  to fix build errors due to the rebase.
* Fix a checkpatch warning for dpu-crtc.c.
* Properly use dev_err_probe() to return it's return value directly where
  possible.

v9->v10:
* Rebase the series upon v5.18-rc1.
* Make 'checkpatch.pl --strict' happier for patch 5/6.
* Add Rob's R-b tag on patch 3/6.
* Add Laurentiu's R-b tag on patch 5/6.
* Add Laurentiu's A-b tag on patch 6/6.

v8->v9:
* Use drm_atomic_get_new_plane_state() in dpu_plane_atomic_update() for
  patch 5/6. (Laurentiu)
* Drop getting DPU DT alias ID for patch 5/6, as it is unused.
* Reference 'interrupts-extended' schema instead of 'interrupts' for patch 3/6
  to require an additional DPR interrupt(r_rtram_stall) because the reference
  manual does mention it, though the driver doesn't get/use it for now.
  Reference 'interrupt-names' schema to define the two DPR interrupt names -
  'dpr_wrap' and 'r_rtram_stall'.  Accordingly, patch 5/6 gets the 'dpr_wrap'
  interrupt by name.
* Drop Rob's R-b tag on patch 3/6, as review is needed.

v7->v8:
* Rebase this series up onto the latest drm-misc-next branch, due to DRM plane
  helper functions API change(atomic_check and atomic_update) from DRM atomic
  core.  So, dpu_plane_atomic_check() and dpu_plane_atomic_update() are updated
  accordingly in patch 5/6.  Also, rename plane->state variables and relevant
  DPU plane state variables in those two functions to reflect they are new
  states, like the patch 'drm: Rename plane->state variables in atomic update
  and disable' recently landed in drm-misc-next.
* Replace drm_gem_fb_prepare_fb() with drm_gem_plane_helper_prepare_fb() in
  patch 5/6, due to DRM core API change.
* Improve DPR burst length for GPU standard tile and 32bpp GPU super tile in
  patch 5/6 to align with the latest version of internal HW documention.

v6->v7:
* Fix return value of dpu_get_irqs() if platform_get_irq() fails. (Laurentiu)
* Use the function array dpu_irq_handler[] to store individual DPU irq handlers.
  (Laurentiu)
* Call get/put() hooks directly to get/put DPU fetchunits for DPU plane groups.
  (Laurentiu)
* Shorten the names of individual DPU irq handlers by using DPU unit abbrev
  names to make writing dpu_irq_handler[] easier.
* Add Rob's R-b tag back on DPU dt-binding patch as change in v6 was reviewed.

v5->v6:
* Use graph schema in the DPU dt-binding.
* Do not use macros where possible in the DPU DRM driver. (Laurentiu)
* Break dpu_plane_atomic_check() into some smaller functions. (Laurentiu)
* Address some minor comments from Laurentiu on the DPU DRM driver.
* Add dpu_crtc_err() helper marco in the DPU DRM driver to tell dmesg
  which CRTC generates error.
* Drop calling dev_set_drvdata() from dpu_drm_bind/unbind() in the DPU DRM
  driver as it is done in dpu_drm_probe().
* Some trivial tweaks.

v4->v5:
* Rebase up onto the latest drm-misc-next branch and remove the hook to
  drm_atomic_helper_legacy_gamma_set() from patch 5/6, because it was dropped
  by the newly landed commit 'drm: automatic legacy gamma support'.
* Remove a redundant blank line from dpu_plane_atomic_update() in patch 5/6.

v3->v4:
* Improve compatible properties in DPU and prefetch engines' dt bindings
  by using enum instead of oneOf+const.
* Add Rob's R-b tags on dt binding patches(patch 1/6, 2/6 and 3/6).
* Add Daniel's A-b tag on patch 4/6.

v2->v3:
* Fix DPU DRM driver build warnings which are
  Reported-by: kernel test robot <lkp@intel.com>.
* Drop DPU DRM driver build dependency on IMX_SCU, as dummy SCU functions have
  been added in header files by the patch 'firmware: imx: add dummy functions'
  which has landed in linux-next/master branch.
* Add a missing blank line in include/drm/drm_atomic.h.

v1->v2:
* Test this patch set also with i.MX8qm LVDS displays.
* Drop the device tree patches because we'll use new dt binding way to
  support i.MX8qm/qxp clocks.  This depends on a not-yet-landed patch set
  to do basic conversions for the platforms.
* Fix dt binding yamllint warnings.
* Require bypass0 and bypass1 clocks for both i.MX8qxp and i.MX8qm in DPU's
  dt binding documentation.
* Use new dt binding way to add clocks in the dt binding examples.
* Address several comments from Laurentiu on the DPU DRM patch.

Liu Ying (6):
  dt-bindings: display: imx: Add i.MX8qxp/qm DPU binding
  dt-bindings: display: imx: Add i.MX8qxp/qm PRG binding
  dt-bindings: display: imx: Add i.MX8qxp/qm DPR channel binding
  drm/atomic: Avoid unused-but-set-variable warning on
    for_each_old_plane_in_state
  drm/imx: Introduce i.MX8qm/qxp DPU DRM
  MAINTAINERS: add maintainer for i.MX8qxp DPU DRM driver

 .../display/imx/fsl,imx8qxp-dprc.yaml         |  100 ++
 .../bindings/display/imx/fsl,imx8qxp-dpu.yaml |  387 ++++++
 .../bindings/display/imx/fsl,imx8qxp-prg.yaml |   60 +
 MAINTAINERS                                   |    9 +
 drivers/gpu/drm/imx/Kconfig                   |    1 +
 drivers/gpu/drm/imx/Makefile                  |    1 +
 drivers/gpu/drm/imx/dpu/Kconfig               |    9 +
 drivers/gpu/drm/imx/dpu/Makefile              |   10 +
 drivers/gpu/drm/imx/dpu/dpu-constframe.c      |  171 +++
 drivers/gpu/drm/imx/dpu/dpu-core.c            | 1044 +++++++++++++++++
 drivers/gpu/drm/imx/dpu/dpu-crtc.c            |  969 +++++++++++++++
 drivers/gpu/drm/imx/dpu/dpu-crtc.h            |   72 ++
 drivers/gpu/drm/imx/dpu/dpu-disengcfg.c       |  117 ++
 drivers/gpu/drm/imx/dpu/dpu-dprc.c            |  715 +++++++++++
 drivers/gpu/drm/imx/dpu/dpu-dprc.h            |   40 +
 drivers/gpu/drm/imx/dpu/dpu-drv.c             |  290 +++++
 drivers/gpu/drm/imx/dpu/dpu-drv.h             |   28 +
 drivers/gpu/drm/imx/dpu/dpu-extdst.c          |  299 +++++
 drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c     |  292 +++++
 drivers/gpu/drm/imx/dpu/dpu-fetcheco.c        |  224 ++++
 drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c      |  152 +++
 drivers/gpu/drm/imx/dpu/dpu-fetchunit.c       |  610 ++++++++++
 drivers/gpu/drm/imx/dpu/dpu-fetchunit.h       |  195 +++
 drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c       |  248 ++++
 drivers/gpu/drm/imx/dpu/dpu-framegen.c        |  395 +++++++
 drivers/gpu/drm/imx/dpu/dpu-gammacor.c        |  223 ++++
 drivers/gpu/drm/imx/dpu/dpu-hscaler.c         |  275 +++++
 drivers/gpu/drm/imx/dpu/dpu-kms.c             |  542 +++++++++
 drivers/gpu/drm/imx/dpu/dpu-kms.h             |   23 +
 drivers/gpu/drm/imx/dpu/dpu-layerblend.c      |  348 ++++++
 drivers/gpu/drm/imx/dpu/dpu-plane.c           |  804 +++++++++++++
 drivers/gpu/drm/imx/dpu/dpu-plane.h           |   59 +
 drivers/gpu/drm/imx/dpu/dpu-prg.c             |  433 +++++++
 drivers/gpu/drm/imx/dpu/dpu-prg.h             |   45 +
 drivers/gpu/drm/imx/dpu/dpu-prv.h             |  231 ++++
 drivers/gpu/drm/imx/dpu/dpu-tcon.c            |  250 ++++
 drivers/gpu/drm/imx/dpu/dpu-vscaler.c         |  308 +++++
 drivers/gpu/drm/imx/dpu/dpu.h                 |  385 ++++++
 include/drm/drm_atomic.h                      |    5 +-
 39 files changed, 10368 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8qxp-dprc.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8qxp-dpu.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8qxp-prg.yaml
 create mode 100644 drivers/gpu/drm/imx/dpu/Kconfig
 create mode 100644 drivers/gpu/drm/imx/dpu/Makefile
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-constframe.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-core.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-disengcfg.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-extdst.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetcheco.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-framegen.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-gammacor.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-hscaler.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-layerblend.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prv.h
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-tcon.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu-vscaler.c
 create mode 100644 drivers/gpu/drm/imx/dpu/dpu.h

Comments

Marcel Ziswiler Jan. 4, 2023, 10:01 a.m. UTC | #1
Hi Liu

Thank you very much!

On Wed, 2022-10-19 at 10:02 +0800, Liu Ying wrote:
> This patch introduces i.MX8qm/qxp Display Processing Unit(DPU) DRM support.
> 
> DPU is comprised of two main components that include a blit engine for
> 2D graphics accelerations(with composition support) and a display
> controller for display output processing, as well as a command sequencer.
> Outside of DPU, optional prefetch engines, a.k.a, Prefetch Resolve
> Gasket(PRG) and Display Prefetch Resolve(DPR), can fetch data from memory
> prior to some DPU fetchunits of blit engine and display controller.  The
> prefetch engines support reading linear formats and resolving Vivante GPU
> tile formats.
> 
> This patch adds kernel modesetting support for the display controller part.
> The driver supports two CRTCs per display controller, planes backed by
> four fetchunits(decode0/1, fetchlayer, fetchwarp), fetchunit allocation
> logic for the two CRTCs, prefetch engines(with tile resolving supported),
> plane upscaling/deinterlacing/yuv2rgb CSC/alpha blending and CRTC gamma
> correction.  The registers of the controller is accessed without command
> sequencer involved, instead just by using CPU.
> 
> Reference manual can be found at:
> https://www.nxp.com/webapp/Download?colCode=IMX8DQXPRM
> 
> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
> ---
> v12->v13:
> * Drop 'drm->irq_enabled = true;' to fix a potential build break
>   reported by 'kernel test robot <lkp@intel.com>'. drm->irq_enabled
>   should not be used by imx-dpu drm as it is only used by legacy
>   drivers with userspace modesetting.
> 
> v11->v12:
> * Rebase upon v6.1-rc1.
> * Minor update on Kconfigs, struct names and macro names due to the rebase.
> 
> v10->v11:
> * Rebase upon v6.0-rc1.
> * Include drm_blend.h and drm_framebuffer.h in dpu-kms.c and dpu-plane.c
>   to fix build errors due to the rebase.
> * Fix a checkpatch warning for dpu-crtc.c.
> * Properly use dev_err_probe() to return it's return value directly where
>   possible.
> 
> v9->v10:
> * Make 'checkpatch.pl --strict' happier.
> * Add Laurentiu's R-b tag.
> 
> v8->v9:
> * Use drm_atomic_get_new_plane_state() in dpu_plane_atomic_update(). (Laurentiu)
> * Drop getting DPU DT alias ID, as it is unused.
> * Get the DPR interrupt(dpr_wrap) by name.
> 
> v7->v8:
> * Update dpu_plane_atomic_check() and dpu_plane_atomic_update(), due to DRM
>   plane helper functions API change(atomic_check and atomic_update) from DRM
>   atomic core.  Also, rename plane->state variables and relevant DPU plane
>   state variables in those two functions to reflect they are new states, like
>   the patch 'drm: Rename plane->state variables in atomic update and disable'
>   recently landed in drm-misc-next.
> * Replace drm_gem_fb_prepare_fb() with drm_gem_plane_helper_prepare_fb(),
>   due to DRM core API change.
> * Use 256byte DPR burst length for GPU standard tile and 128byte DPR burst
>   length for 32bpp GPU super tile to align with the latest version of internal
>   HW documention.
> 
> v6->v7:
> * Fix return value of dpu_get_irqs() if platform_get_irq() fails. (Laurentiu)
> * Use the function array dpu_irq_handler[] to store individual DPU irq handlers.
>   (Laurentiu)
> * Call get/put() hooks directly to get/put DPU fetchunits for DPU plane groups.
>   (Laurentiu)
> * Shorten the names of individual DPU irq handlers by using DPU unit abbrev
>   names to make writing dpu_irq_handler[] easier.
> 
> v5->v6:
> * Do not use macros where possible. (Laurentiu)
> * Break dpu_plane_atomic_check() into some smaller functions. (Laurentiu)
> * Address some minor comments from Laurentiu.
> * Add dpu_crtc_err() helper marco to tell dmesg which CRTC generates error.
> * Drop calling dev_set_drvdata() from dpu_drm_bind/unbind() as it is done
>   in dpu_drm_probe().
> * Some trivial tweaks.
> 
> v4->v5:
> * Rebase up onto the latest drm-misc-next branch and remove the hook to
>   drm_atomic_helper_legacy_gamma_set(), because it was dropped by the newly
>   landed commit 'drm: automatic legacy gamma support'.
> * Remove a redundant blank line from dpu_plane_atomic_update().
> 
> v3->v4:
> * No change.
> 
> v2->v3:
> * Fix build warnings Reported-by: kernel test robot <lkp@intel.com>.
> * Drop build dependency on IMX_SCU, as dummy SCU functions have been added in
>   header files by the patch 'firmware: imx: add dummy functions' which has
>   landed in linux-next/master branch.
> 
> v1->v2:
> * Add compatible for i.MX8qm DPU, as this is tested with i.MX8qm LVDS displays.
>   (Laurentiu)
> * Fix PRG burst size and stride. (Laurentiu)
> * Put 'ports' OF node to fix the bail-out logic in dpu_drm_probe(). (Laurentiu)
> 
>  drivers/gpu/drm/imx/Kconfig               |    1 +
>  drivers/gpu/drm/imx/Makefile              |    1 +
>  drivers/gpu/drm/imx/dpu/Kconfig           |    9 +
>  drivers/gpu/drm/imx/dpu/Makefile          |   10 +
>  drivers/gpu/drm/imx/dpu/dpu-constframe.c  |  171 ++++
>  drivers/gpu/drm/imx/dpu/dpu-core.c        | 1044 +++++++++++++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-crtc.c        |  969 +++++++++++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-crtc.h        |   72 ++
>  drivers/gpu/drm/imx/dpu/dpu-disengcfg.c   |  117 +++
>  drivers/gpu/drm/imx/dpu/dpu-dprc.c        |  715 ++++++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-dprc.h        |   40 +
>  drivers/gpu/drm/imx/dpu/dpu-drv.c         |  290 ++++++
>  drivers/gpu/drm/imx/dpu/dpu-drv.h         |   28 +
>  drivers/gpu/drm/imx/dpu/dpu-extdst.c      |  299 ++++++
>  drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c |  292 ++++++
>  drivers/gpu/drm/imx/dpu/dpu-fetcheco.c    |  224 +++++
>  drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c  |  152 +++
>  drivers/gpu/drm/imx/dpu/dpu-fetchunit.c   |  610 ++++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-fetchunit.h   |  195 ++++
>  drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c   |  248 +++++
>  drivers/gpu/drm/imx/dpu/dpu-framegen.c    |  395 ++++++++
>  drivers/gpu/drm/imx/dpu/dpu-gammacor.c    |  223 +++++
>  drivers/gpu/drm/imx/dpu/dpu-hscaler.c     |  275 ++++++
>  drivers/gpu/drm/imx/dpu/dpu-kms.c         |  542 +++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-kms.h         |   23 +
>  drivers/gpu/drm/imx/dpu/dpu-layerblend.c  |  348 +++++++
>  drivers/gpu/drm/imx/dpu/dpu-plane.c       |  804 ++++++++++++++++
>  drivers/gpu/drm/imx/dpu/dpu-plane.h       |   59 ++
>  drivers/gpu/drm/imx/dpu/dpu-prg.c         |  433 +++++++++
>  drivers/gpu/drm/imx/dpu/dpu-prg.h         |   45 +
>  drivers/gpu/drm/imx/dpu/dpu-prv.h         |  231 +++++
>  drivers/gpu/drm/imx/dpu/dpu-tcon.c        |  250 +++++
>  drivers/gpu/drm/imx/dpu/dpu-vscaler.c     |  308 ++++++
>  drivers/gpu/drm/imx/dpu/dpu.h             |  385 ++++++++
>  34 files changed, 9808 insertions(+)
>  create mode 100644 drivers/gpu/drm/imx/dpu/Kconfig
>  create mode 100644 drivers/gpu/drm/imx/dpu/Makefile
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-constframe.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-core.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-disengcfg.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-extdst.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetcheco.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-framegen.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-gammacor.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-hscaler.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-layerblend.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prv.h
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-tcon.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-vscaler.c
>  create mode 100644 drivers/gpu/drm/imx/dpu/dpu.h

[snip]

> diff --git a/drivers/gpu/drm/imx/dpu/dpu-drv.c b/drivers/gpu/drm/imx/dpu/dpu-drv.c
> new file mode 100644
> index 000000000000..2a2dd92269c8
> --- /dev/null
> +++ b/drivers/gpu/drm/imx/dpu/dpu-drv.c
> @@ -0,0 +1,290 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/*
> + * Copyright 2019,2020,2022 NXP
> + */
> +
> +#include <linux/component.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_drv.h>

This may also need the following addition:

#include <drm/drm_fbdev_generic.h>

Otherwise I do get the following error on compilation:

  CC [M]  drivers/gpu/drm/imx/dpu/dpu-drv.o
/var/home/zim/Sources/linux-next.git/drivers/gpu/drm/imx/dpu/dpu-drv.c: In function 'dpu_drm_bind':
/var/home/zim/Sources/linux-next.git/drivers/gpu/drm/imx/dpu/dpu-drv.c:99:9: error: implicit declaration of
function 'drm_fbdev_generic_setup' [-Werror=implicit-function-declaration]
   99 |         drm_fbdev_generic_setup(drm, legacyfb_depth);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [/var/home/zim/Sources/linux-next.git/scripts/Makefile.build:252: drivers/gpu/drm/imx/dpu/dpu-
drv.o] Error 1
make[7]: *** Waiting for unfinished jobs....

> +#include <drm/drm_fb_helper.h>
> +#include <drm/drm_gem_dma_helper.h>
> +#include <drm/drm_modeset_helper.h>
> +#include <drm/drm_of.h>
> +#include <drm/drm_print.h>
> +#include <drm/drm_probe_helper.h>
> +
> +#include "dpu-drv.h"
> +#include "dpu-kms.h"
> +
> +#define DRIVER_NAME    "imx-dpu-drm"

[snip]

I am trying to actually get this to work on Apalis iMX8 [1] and Colibri iMX8X [2] but so far I am still missing
some crucial recent changes on the SoC device tree side for the dc-pixel-link (e.g. fsl,dc-id and fsl,dc-
stream-id),  lvds-csr (e.g. dropped clock-names) and/or dpr-channel (e.g. interrupts-extended especially the
resp. dc0_irqsteer numbers) parts. If you know of a recent complete git tree with working examples like back in
the day [3], let me know. Let's see...

[1] https://lore.kernel.org/all/20230102171023.33853-1-marcel@ziswiler.com/
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ba5a5615d54f8adfeb4edd005bbd0dfeb65feb9f
[3] https://lore.kernel.org/all/c4c93c217d21dc20435fd7615c146397d4fcafc7.camel@nxp.com/

Cheers

Marcel
Liu Ying Jan. 19, 2023, 2:04 a.m. UTC | #2
Hi Marcel,

On Wed, 2023-01-04 at 10:01 +0000, Marcel Ziswiler wrote:
> Hi Liu
> 
> Thank you very much!
> 
> On Wed, 2022-10-19 at 10:02 +0800, Liu Ying wrote:
> > This patch introduces i.MX8qm/qxp Display Processing Unit(DPU) DRM
> > support.
> > 
> > DPU is comprised of two main components that include a blit engine
> > for
> > 2D graphics accelerations(with composition support) and a display
> > controller for display output processing, as well as a command
> > sequencer.
> > Outside of DPU, optional prefetch engines, a.k.a, Prefetch Resolve
> > Gasket(PRG) and Display Prefetch Resolve(DPR), can fetch data from
> > memory
> > prior to some DPU fetchunits of blit engine and display
> > controller.  The
> > prefetch engines support reading linear formats and resolving
> > Vivante GPU
> > tile formats.
> > 
> > This patch adds kernel modesetting support for the display
> > controller part.
> > The driver supports two CRTCs per display controller, planes backed
> > by
> > four fetchunits(decode0/1, fetchlayer, fetchwarp), fetchunit
> > allocation
> > logic for the two CRTCs, prefetch engines(with tile resolving
> > supported),
> > plane upscaling/deinterlacing/yuv2rgb CSC/alpha blending and CRTC
> > gamma
> > correction.  The registers of the controller is accessed without
> > command
> > sequencer involved, instead just by using CPU.
> > 
> > Reference manual can be found at:
> > 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nxp.com%2Fwebapp%2FDownload%3FcolCode%3DIMX8DQXPRM&data=05%7C01%7Cvictor.liu%40nxp.com%7Cf90aa93b0cb145ed962e08daee3a9c4e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638084232760483936%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=4oy%2BQF%2BnTzinsMhjq5swmvVDZSZwK8h%2BtUbOIxveqHE%3D&reserved=0
> > 
> > Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> > Signed-off-by: Liu Ying <victor.liu@nxp.com>
> > ---
> > v12->v13:
> > * Drop 'drm->irq_enabled = true;' to fix a potential build break
> >   reported by 'kernel test robot <lkp@intel.com>'. drm->irq_enabled
> >   should not be used by imx-dpu drm as it is only used by legacy
> >   drivers with userspace modesetting.
> > 
> > v11->v12:
> > * Rebase upon v6.1-rc1.
> > * Minor update on Kconfigs, struct names and macro names due to the
> > rebase.
> > 
> > v10->v11:
> > * Rebase upon v6.0-rc1.
> > * Include drm_blend.h and drm_framebuffer.h in dpu-kms.c and dpu-
> > plane.c
> >   to fix build errors due to the rebase.
> > * Fix a checkpatch warning for dpu-crtc.c.
> > * Properly use dev_err_probe() to return it's return value directly
> > where
> >   possible.
> > 
> > v9->v10:
> > * Make 'checkpatch.pl --strict' happier.
> > * Add Laurentiu's R-b tag.
> > 
> > v8->v9:
> > * Use drm_atomic_get_new_plane_state() in
> > dpu_plane_atomic_update(). (Laurentiu)
> > * Drop getting DPU DT alias ID, as it is unused.
> > * Get the DPR interrupt(dpr_wrap) by name.
> > 
> > v7->v8:
> > * Update dpu_plane_atomic_check() and dpu_plane_atomic_update(),
> > due to DRM
> >   plane helper functions API change(atomic_check and atomic_update)
> > from DRM
> >   atomic core.  Also, rename plane->state variables and relevant
> > DPU plane
> >   state variables in those two functions to reflect they are new
> > states, like
> >   the patch 'drm: Rename plane->state variables in atomic update
> > and disable'
> >   recently landed in drm-misc-next.
> > * Replace drm_gem_fb_prepare_fb() with
> > drm_gem_plane_helper_prepare_fb(),
> >   due to DRM core API change.
> > * Use 256byte DPR burst length for GPU standard tile and 128byte
> > DPR burst
> >   length for 32bpp GPU super tile to align with the latest version
> > of internal
> >   HW documention.
> > 
> > v6->v7:
> > * Fix return value of dpu_get_irqs() if platform_get_irq() fails.
> > (Laurentiu)
> > * Use the function array dpu_irq_handler[] to store individual DPU
> > irq handlers.
> >   (Laurentiu)
> > * Call get/put() hooks directly to get/put DPU fetchunits for DPU
> > plane groups.
> >   (Laurentiu)
> > * Shorten the names of individual DPU irq handlers by using DPU
> > unit abbrev
> >   names to make writing dpu_irq_handler[] easier.
> > 
> > v5->v6:
> > * Do not use macros where possible. (Laurentiu)
> > * Break dpu_plane_atomic_check() into some smaller functions.
> > (Laurentiu)
> > * Address some minor comments from Laurentiu.
> > * Add dpu_crtc_err() helper marco to tell dmesg which CRTC
> > generates error.
> > * Drop calling dev_set_drvdata() from dpu_drm_bind/unbind() as it
> > is done
> >   in dpu_drm_probe().
> > * Some trivial tweaks.
> > 
> > v4->v5:
> > * Rebase up onto the latest drm-misc-next branch and remove the
> > hook to
> >   drm_atomic_helper_legacy_gamma_set(), because it was dropped by
> > the newly
> >   landed commit 'drm: automatic legacy gamma support'.
> > * Remove a redundant blank line from dpu_plane_atomic_update().
> > 
> > v3->v4:
> > * No change.
> > 
> > v2->v3:
> > * Fix build warnings Reported-by: kernel test robot <lkp@intel.com>
> > .
> > * Drop build dependency on IMX_SCU, as dummy SCU functions have
> > been added in
> >   header files by the patch 'firmware: imx: add dummy functions'
> > which has
> >   landed in linux-next/master branch.
> > 
> > v1->v2:
> > * Add compatible for i.MX8qm DPU, as this is tested with i.MX8qm
> > LVDS displays.
> >   (Laurentiu)
> > * Fix PRG burst size and stride. (Laurentiu)
> > * Put 'ports' OF node to fix the bail-out logic in dpu_drm_probe().
> > (Laurentiu)
> > 
> >  drivers/gpu/drm/imx/Kconfig               |    1 +
> >  drivers/gpu/drm/imx/Makefile              |    1 +
> >  drivers/gpu/drm/imx/dpu/Kconfig           |    9 +
> >  drivers/gpu/drm/imx/dpu/Makefile          |   10 +
> >  drivers/gpu/drm/imx/dpu/dpu-constframe.c  |  171 ++++
> >  drivers/gpu/drm/imx/dpu/dpu-core.c        | 1044
> > +++++++++++++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-crtc.c        |  969
> > +++++++++++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-crtc.h        |   72 ++
> >  drivers/gpu/drm/imx/dpu/dpu-disengcfg.c   |  117 +++
> >  drivers/gpu/drm/imx/dpu/dpu-dprc.c        |  715 ++++++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-dprc.h        |   40 +
> >  drivers/gpu/drm/imx/dpu/dpu-drv.c         |  290 ++++++
> >  drivers/gpu/drm/imx/dpu/dpu-drv.h         |   28 +
> >  drivers/gpu/drm/imx/dpu/dpu-extdst.c      |  299 ++++++
> >  drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c |  292 ++++++
> >  drivers/gpu/drm/imx/dpu/dpu-fetcheco.c    |  224 +++++
> >  drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c  |  152 +++
> >  drivers/gpu/drm/imx/dpu/dpu-fetchunit.c   |  610 ++++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-fetchunit.h   |  195 ++++
> >  drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c   |  248 +++++
> >  drivers/gpu/drm/imx/dpu/dpu-framegen.c    |  395 ++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-gammacor.c    |  223 +++++
> >  drivers/gpu/drm/imx/dpu/dpu-hscaler.c     |  275 ++++++
> >  drivers/gpu/drm/imx/dpu/dpu-kms.c         |  542 +++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-kms.h         |   23 +
> >  drivers/gpu/drm/imx/dpu/dpu-layerblend.c  |  348 +++++++
> >  drivers/gpu/drm/imx/dpu/dpu-plane.c       |  804 ++++++++++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-plane.h       |   59 ++
> >  drivers/gpu/drm/imx/dpu/dpu-prg.c         |  433 +++++++++
> >  drivers/gpu/drm/imx/dpu/dpu-prg.h         |   45 +
> >  drivers/gpu/drm/imx/dpu/dpu-prv.h         |  231 +++++
> >  drivers/gpu/drm/imx/dpu/dpu-tcon.c        |  250 +++++
> >  drivers/gpu/drm/imx/dpu/dpu-vscaler.c     |  308 ++++++
> >  drivers/gpu/drm/imx/dpu/dpu.h             |  385 ++++++++
> >  34 files changed, 9808 insertions(+)
> >  create mode 100644 drivers/gpu/drm/imx/dpu/Kconfig
> >  create mode 100644 drivers/gpu/drm/imx/dpu/Makefile
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-constframe.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-core.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-crtc.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-disengcfg.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-dprc.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-drv.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-extdst.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchdecode.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetcheco.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchlayer.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchunit.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-fetchwarp.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-framegen.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-gammacor.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-hscaler.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-kms.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-layerblend.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-plane.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prg.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-prv.h
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-tcon.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu-vscaler.c
> >  create mode 100644 drivers/gpu/drm/imx/dpu/dpu.h
> 
> [snip]
> 
> > diff --git a/drivers/gpu/drm/imx/dpu/dpu-drv.c
> > b/drivers/gpu/drm/imx/dpu/dpu-drv.c
> > new file mode 100644
> > index 000000000000..2a2dd92269c8
> > --- /dev/null
> > +++ b/drivers/gpu/drm/imx/dpu/dpu-drv.c
> > @@ -0,0 +1,290 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +
> > +/*
> > + * Copyright 2019,2020,2022 NXP
> > + */
> > +
> > +#include <linux/component.h>
> > +#include <linux/dma-mapping.h>
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/platform_device.h>
> > +
> > +#include <drm/drm_atomic_helper.h>
> > +#include <drm/drm_drv.h>
> 
> This may also need the following addition:
> 
> #include <drm/drm_fbdev_generic.h>
> 
> Otherwise I do get the following error on compilation:
> 
>   CC [M]  drivers/gpu/drm/imx/dpu/dpu-drv.o
> /var/home/zim/Sources/linux-next.git/drivers/gpu/drm/imx/dpu/dpu-
> drv.c: In function 'dpu_drm_bind':
> /var/home/zim/Sources/linux-next.git/drivers/gpu/drm/imx/dpu/dpu-
> drv.c:99:9: error: implicit declaration of
> function 'drm_fbdev_generic_setup' [-Werror=implicit-function-
> declaration]
>    99 |         drm_fbdev_generic_setup(drm, legacyfb_depth);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
> make[7]: *** [/var/home/zim/Sources/linux-
> next.git/scripts/Makefile.build:252: drivers/gpu/drm/imx/dpu/dpu-
> drv.o] Error 1
> make[7]: *** Waiting for unfinished jobs....

This build break is caused by the below commit introduced in v6.2-rc1. 
The include/drm/drm_fbdev_generic.h head file was newly introduced in
the commit.
8ab59da26bc0 (drm/fb-helper: Move generic fbdev emulation into separate
source file)

I've rebased this patch set upon drm-misc-next to fix this build break
by including the head file and sent v14 for review.

> 
> > +#include <drm/drm_fb_helper.h>
> > +#include <drm/drm_gem_dma_helper.h>
> > +#include <drm/drm_modeset_helper.h>
> > +#include <drm/drm_of.h>
> > +#include <drm/drm_print.h>
> > +#include <drm/drm_probe_helper.h>
> > +
> > +#include "dpu-drv.h"
> > +#include "dpu-kms.h"
> > +
> > +#define DRIVER_NAME    "imx-dpu-drm"
> 
> [snip]
> 
> I am trying to actually get this to work on Apalis iMX8 [1] and
> Colibri iMX8X [2] but so far I am still missing
> some crucial recent changes on the SoC device tree side for the dc-
> pixel-link (e.g. fsl,dc-id and fsl,dc-
> stream-id),  lvds-csr (e.g. dropped clock-names) and/or dpr-channel
> (e.g. interrupts-extended especially the
> resp. dc0_irqsteer numbers) parts. If you know of a recent complete
> git tree with working examples like back in
> the day [3], let me know. Let's see...

Like I commented in another thread(
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230118072656.18845-6-marcel@ziswiler.com/
), I'll see if I can share some local patches/changes to you in some
way as we don't have any official git to share them, or please wait
until they are submitted for review.

Regards,
Liu Ying

> 
> [1] 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F20230102171023.33853-1-marcel%40ziswiler.com%2F&data=05%7C01%7Cvictor.liu%40nxp.com%7Cf90aa93b0cb145ed962e08daee3a9c4e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638084232760483936%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YanxvVSRTkpMaRifVM%2B%2BiCGcTMb9mAumtUCyoBwAGks%3D&reserved=0
> [2]
> 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fcommit%2F%3Fid%3Dba5a5615d54f8adfeb4edd005bbd0dfeb65feb9f&data=05%7C01%7Cvictor.liu%40nxp.com%7Cf90aa93b0cb145ed962e08daee3a9c4e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638084232760640140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WZZfPkLL9HWqykuRtj96eMePEAbpIRW63DTZXqAPuEA%3D&reserved=0
> [3] 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2Fc4c93c217d21dc20435fd7615c146397d4fcafc7.camel%40nxp.com%2F&data=05%7C01%7Cvictor.liu%40nxp.com%7Cf90aa93b0cb145ed962e08daee3a9c4e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638084232760640140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bZyeEQeUAXuYq9UXYYXjPCjoeTln7kT8Y8B2xAj%2Fp2o%3D&reserved=0
> 
> Cheers
> 
> Marcel