[PATCH v1 0/9] Overview of Arm komeda display driver

From: james qian wang (Arm Technology China)
Date: Wed Dec 05 2018 - 05:17:50 EST

This is the first patchset of ARM new komeda display driver, this patchset added
all basic structure of komeda, relationship of DRM-KMS with komeda, for tring to
give a brife overview of komeda-driver.

komeda is for supporting the ARM display processor D71 and later IPs, Since from
D71, Arm display IP begins to adopt a flexible and modularized architecture:
A display pipeline is made up of multiple individual and functional pipeline
stages called components, and every component has some specific capabilities
that can give the flowed pipeline pixel data a specific data processing.

The typical components like:

- Layer:
Layer is the first pipeline stage, It fetches the pixel from memory and
prepare the source pixel data for the next stage, like rotation, format,
color-space handling.

- Scaler:
As its name, scaler is for scaling and image enhancement.

- Compositor (compiz)
Compositor is for blending multiple layers or pixel data flows into one
single display frame.

- Writeback Layer (wb_layer)
Writeback layer do the opposite things of Layer, Which connect to compiz
for writing the composition result to memory.

- Post image processor (improc)
Post image processor is for adjusting frame data like gamma and color space
to fit the requirements of the monitor.

- Timing controller (timing_ctrlr)
Final stage of display pipeline, Timing controller is not for the pixel
handling, but only for controlling the display timing.

Benefit from the modularized architecture, D71 pipelines can be easily adjusted
to fit different usages, two D71 pipelines can work independently and separately

- Single pipeline mode

Layer_0 -> (scaler) ->\
Layer_1 -> (scaler) ->\ /-> (scaler) -> wb_layer -> memory
compiz ->
Layer_2 -> (scaler) ->/ \-> improc ->timing_ctrlr ->monitor
Layer_3 -> (scaler) ->/

Or work together to drive only one display output. On this mode, the compositor
output of pipeline_B will be merged into pipeline_A as an input of compositor
of pipeline_A, then pipeline_B doesn't has its output and work as a slave of

- Slave enabled data flow

Layer_0 -> (scaler) ->\
Layer_1 -> (scaler) ->\
compiz_B -> compiz_A
Layer_2 -> (scaler) ->/
Layer_3 -> (scaler) ->/

compiz_B ->\
Layer_4 -> (scaler) ->\
Layer_5 -> (scaler) ->\ /-> (scaler) -> wb_layer -> memory
compiz_A ->
Layer_6 -> (scaler) ->/ \-> improc ->timing_ctrlr ->monitor
Layer_7 -> (scaler) ->/

To fully utilize and easily access/configure the HW, komeda use similar
architecture: Pipeline/Component to describe the HW features and capabilities.
Add the DRM-KMS consideration. then:

A Komeda driver is comprised of two layers of data structures:

1. komeda_dev/pipeline/component
which are used by komeda driver to describe and abstract a display HW.
- komeda_layer/scaler/compiz/improc/timing_ctrlr
for describing a specific pipeline component stage.
- komeda_pipeline
for abstracting a display pipeline and the pipeline is composed of multiple
- komeda_dev
for the whole view of the device, manage the pipeline, irq, and the other
control-abilites of device.

2. komeda_kms_dev/crtc/plane:
which connect Komeda-dev to DRM-KMS, basically it collects and organizes
komeda_dev's capabilites and resurces by DRM-KMS's way (crtc/plane/connector),
and convert the DRM-KMS's requirement to the real komeda_dev's configuration.

So generally, the komeda_dev is like a resource collection, and the komeda_kms
is a group of users (crtc/plane/wb_connector), the drm_state defined or
described the resource requirement of user, and every KMS-OBJ maps or represents
to a specific komeda data pipeline:

- Plane: Layer -> (Scaler) -> Compiz
- Wb_connector: Compiz-> (scaler) -> Wb_layer -> memory
- Crtc: Compiz -> Improc -> Timing_Ctrlr -> Monitor

The features and properties of KMS-OBJ based on the mapping pipeline, and the
komeda_kms level function (crtc/plane/wb_connector->atomic_check) actually
is for pickuping suitable pipeline and component resources, configure them to
a specific state and build these input/output pipeline of komeda to fit the

Furthermore, To support multiple IPs, komeda_dev has been split into two layers:

- Komeda-CORE or common layer.
for the common feature validation and handling
- Komeda-CHIP.
for reporting and exposing the HW resource by CORE's way, the HW register
programming and updating.

With this two Layer's device abstraction, the most operations are handled in
Komeda-CORE, the Komeda-CHIP is only for CHIP-specific stuff, easy for adding
new chipset or IP in future.

James (Qian) Wang (9):
drm/komeda: komeda_dev/pipeline/component definition and initialzation
dt/bindings: drm/komeda: Add DT bindings for ARM display processor D71
drm/komeda: Build komeda to be a platform module
drm/komeda: Add DT parsing
drm/komeda: Add komeda_format_caps for format handling
drm/komeda: Add komeda_framebuffer
drm/komeda: Attach komeda_dev to DRM-KMS
drm/doc: Add initial komeda driver documentation
MAINTAINERS: Add maintainer for arm komeda driver

.../bindings/display/arm/arm,komeda.txt | 87 ++++
Documentation/gpu/drivers.rst | 1 +
Documentation/gpu/komeda-kms.rst | 483 ++++++++++++++++++
drivers/gpu/drm/arm/Kconfig | 2 +
drivers/gpu/drm/arm/Makefile | 1 +
drivers/gpu/drm/arm/display/Kbuild | 3 +
drivers/gpu/drm/arm/display/Kconfig | 14 +
.../gpu/drm/arm/display/include/malidp_io.h | 42 ++
.../drm/arm/display/include/malidp_product.h | 23 +
.../drm/arm/display/include/malidp_utils.h | 16 +
drivers/gpu/drm/arm/display/komeda/Makefile | 21 +
.../gpu/drm/arm/display/komeda/d71/d71_dev.c | 111 ++++
.../gpu/drm/arm/display/komeda/komeda_crtc.c | 106 ++++
.../gpu/drm/arm/display/komeda/komeda_dev.c | 193 +++++++
.../gpu/drm/arm/display/komeda/komeda_dev.h | 113 ++++
.../gpu/drm/arm/display/komeda/komeda_drv.c | 144 ++++++
.../arm/display/komeda/komeda_format_caps.c | 75 +++
.../arm/display/komeda/komeda_format_caps.h | 89 ++++
.../arm/display/komeda/komeda_framebuffer.c | 165 ++++++
.../arm/display/komeda/komeda_framebuffer.h | 31 ++
.../gpu/drm/arm/display/komeda/komeda_kms.c | 168 ++++++
.../gpu/drm/arm/display/komeda/komeda_kms.h | 113 ++++
.../drm/arm/display/komeda/komeda_pipeline.c | 202 ++++++++
.../drm/arm/display/komeda/komeda_pipeline.h | 356 +++++++++++++
.../gpu/drm/arm/display/komeda/komeda_plane.c | 109 ++++
.../arm/display/komeda/komeda_private_obj.c | 87 ++++
27 files changed, 2763 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/arm/arm,komeda.txt
create mode 100644 Documentation/gpu/komeda-kms.rst
create mode 100644 drivers/gpu/drm/arm/display/Kbuild
create mode 100644 drivers/gpu/drm/arm/display/Kconfig
create mode 100644 drivers/gpu/drm/arm/display/include/malidp_io.h
create mode 100644 drivers/gpu/drm/arm/display/include/malidp_product.h
create mode 100644 drivers/gpu/drm/arm/display/include/malidp_utils.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/Makefile
create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_drv.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_plane.c
create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c