All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Boris Brezillon <bbrezillon@kernel.org>
Subject: [PATCH v7.1 06/54] drm/bridge: Improve overview documentation
Date: Sat, 22 Feb 2020 18:48:32 +0200	[thread overview]
Message-ID: <20200222164832.18338-1-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20200222150106.22919-7-laurent.pinchart@ideasonboard.com>

Clean up the drm_bridge overview documentation, and expand the
operations documentation to provide more details on API usage.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Change since v7:

- Detail how bridge operations are used by atomic helpers
---
 Documentation/gpu/drm-kms-helpers.rst |   6 +-
 drivers/gpu/drm/drm_bridge.c          | 101 +++++++++++++++++++-------
 2 files changed, 79 insertions(+), 28 deletions(-)

diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst
index 9668a7fe2408..fe155c6ae175 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -139,11 +139,11 @@ Overview
 .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
    :doc: overview
 
-Default bridge callback sequence
---------------------------------
+Bridge Operations
+-----------------
 
 .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
-   :doc: bridge callbacks
+   :doc: bridge operations
 
 
 Bridge Helper Reference
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 68ab933ee430..52dfc67a6cf8 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -39,26 +39,50 @@
  * encoder chain.
  *
  * A bridge is always attached to a single &drm_encoder at a time, but can be
- * either connected to it directly, or through an intermediate bridge::
- *
- *     encoder ---> bridge B ---> bridge A
- *
- * Here, the output of the encoder feeds to bridge B, and that furthers feeds to
- * bridge A.
- *
- * The driver using the bridge is responsible to make the associations between
- * the encoder and bridges. Once these links are made, the bridges will
- * participate along with encoder functions to perform mode_set/enable/disable
- * through the ops provided in &drm_bridge_funcs.
- *
- * drm_bridge, like drm_panel, aren't drm_mode_object entities like planes,
+ * either connected to it directly, or through a chain of bridges::
+ *
+ *     [ CRTC ---> ] Encoder ---> Bridge A ---> Bridge B
+ *
+ * Here, the output of the encoder feeds to bridge A, and that furthers feeds to
+ * bridge B. Bridge chains can be arbitrarily long, and shall be fully linear:
+ * Chaining multiple bridges to the output of a bridge, or the same bridge to
+ * the output of different bridges, is not supported.
+ *
+ * Display drivers are responsible for linking encoders with the first bridge
+ * in the chains. This is done by acquiring the appropriate bridge with
+ * of_drm_find_bridge() or drm_of_find_panel_or_bridge(), or creating it for a
+ * panel with drm_panel_bridge_add_typed() (or the managed version
+ * devm_drm_panel_bridge_add_typed()). Once acquired, the bridge shall be
+ * attached to the encoder with a call to drm_bridge_attach().
+ *
+ * Bridges are responsible for linking themselves with the next bridge in the
+ * chain, if any. This is done the same way as for encoders, with the call to
+ * drm_bridge_attach() occurring in the &drm_bridge_funcs.attach operation.
+ *
+ * Once these links are created, the bridges can participate along with encoder
+ * functions to perform mode validation and fixup (through
+ * drm_bridge_chain_mode_valid() and drm_atomic_bridge_chain_check()), mode
+ * setting (through drm_bridge_chain_mode_set()), enable (through
+ * drm_atomic_bridge_chain_pre_enable() and drm_atomic_bridge_chain_enable())
+ * and disable (through drm_atomic_bridge_chain_disable() and
+ * drm_atomic_bridge_chain_post_disable()). Those functions call the
+ * corresponding operations provided in &drm_bridge_funcs in sequence for all
+ * bridges in the chain.
+ *
+ * For display drivers that use the atomic helpers
+ * drm_atomic_helper_check_modeset(),
+ * drm_atomic_helper_commit_modeset_enables() and
+ * drm_atomic_helper_commit_modeset_disables() (either directly in hand-rolled
+ * commit check and commit tail handlers, or through the higher-level
+ * drm_atomic_helper_check() and drm_atomic_helper_commit_tail() or
+ * drm_atomic_helper_commit_tail_rpm() helpers), this is done transparently and
+ * requires no intervention from the driver. For other drivers, the relevant
+ * DRM bridge chain functions shall be called manually.
+ *
+ * &drm_bridge, like &drm_panel, aren't &drm_mode_object entities like planes,
  * CRTCs, encoders or connectors and hence are not visible to userspace. They
  * just provide additional hooks to get the desired output at the end of the
  * encoder chain.
- *
- * Bridges can also be chained up using the &drm_bridge.chain_node field.
- *
- * Both legacy CRTC helpers and the new atomic modeset helpers support bridges.
  */
 
 static DEFINE_MUTEX(bridge_lock);
@@ -212,14 +236,41 @@ void drm_bridge_detach(struct drm_bridge *bridge)
 }
 
 /**
- * DOC: bridge callbacks
- *
- * The &drm_bridge_funcs ops are populated by the bridge driver. The DRM
- * internals (atomic and CRTC helpers) use the helpers defined in drm_bridge.c
- * These helpers call a specific &drm_bridge_funcs op for all the bridges
- * during encoder configuration.
- *
- * For detailed specification of the bridge callbacks see &drm_bridge_funcs.
+ * DOC: bridge operations
+ *
+ * Bridge drivers expose operations through the &drm_bridge_funcs structure.
+ * The DRM internals (atomic and CRTC helpers) use the helpers defined in
+ * drm_bridge.c to call bridge operations. Those operations are divided in
+ * two big categories to support different parts of the bridge usage.
+ *
+ * - The encoder-related operations support control of the bridges in the
+ *   chain, and are roughly counterparts to the &drm_encoder_helper_funcs
+ *   operations. They are used by the legacy CRTC and the atomic modeset
+ *   helpers to perform mode validation, fixup and setting, and enable and
+ *   disable the bridge automatically.
+ *
+ *   The enable and disable operations are split in
+ *   &drm_bridge_funcs.pre_enable, &drm_bridge_funcs.enable,
+ *   &drm_bridge_funcs.disable and &drm_bridge_funcs.post_disable to provide
+ *   finer-grained control.
+ *
+ *   Bridge drivers may implement the legacy version of those operations, or
+ *   the atomic version (prefixed with atomic\_), in which case they shall also
+ *   implement the atomic state bookkeeping operations
+ *   (&drm_bridge_funcs.atomic_duplicate_state,
+ *   &drm_bridge_funcs.atomic_destroy_state and &drm_bridge_funcs.reset).
+ *   Mixing atomic and non-atomic versions of the operations is not supported.
+ *
+ * - The bus format negotiation operations
+ *   &drm_bridge_funcs.atomic_get_output_bus_fmts and
+ *   &drm_bridge_funcs.atomic_get_input_bus_fmts allow bridge drivers to
+ *   negotiate the formats transmitted between bridges in the chain when
+ *   multiple formats are supported. Negotiation for formats is performed
+ *   transparently for display drivers by the atomic modeset helpers. Only
+ *   atomic versions of those operations exist, bridge drivers that need to
+ *   implement them shall thus also implement the atomic version of the
+ *   encoder-related operations. This feature is not supported by the legacy
+ *   CRTC helpers.
  */
 
 /**
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-02-22 16:49 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22 15:00 [PATCH v7 00/54] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 01/54] video: hdmi: Change return type of hdmi_avi_infoframe_init() to void Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 02/54] drm/connector: Add helper to get a connector type name Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 03/54] drm/edid: Add flag to drm_display_info to identify HDMI sinks Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 04/54] drm/bridge: Document the drm_encoder.bridge_chain field as private Laurent Pinchart
2020-02-25 15:25   ` Boris Brezillon
2020-02-22 15:00 ` [PATCH v7 05/54] drm/bridge: Fix atomic state ops documentation Laurent Pinchart
2020-02-25 15:28   ` Boris Brezillon
2020-02-22 15:00 ` [PATCH v7 06/54] drm/bridge: Improve overview documentation Laurent Pinchart
2020-02-22 15:32   ` Daniel Vetter
2020-02-22 15:34     ` Laurent Pinchart
2020-02-22 16:48   ` Laurent Pinchart [this message]
2020-02-22 15:00 ` [PATCH v7 07/54] drm/bridge: Add connector-related bridge operations and data Laurent Pinchart
2020-02-22 15:34   ` Daniel Vetter
2020-02-22 15:00 ` [PATCH v7 08/54] drm/bridge: Add interlace_allowed flag to drm_bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 09/54] drm/bridge: Extend bridge API to disable connector creation Laurent Pinchart
2020-02-22 16:49   ` [PATCH v7.1 " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 10/54] drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 11/54] drm/bridge: dumb-vga-dac: Rename driver " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 12/54] drm/bridge: simple-bridge: Add support for non-VGA bridges Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 13/54] drm/bridge: simple-bridge: Add support for enable GPIO Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 14/54] drm/bridge: simple-bridge: Add support for the TI OPA362 Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 15/54] drm/bridge: Add bridge driver for display connectors Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 16/54] drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 17/54] drm/bridge: panel: Implement bridge connector operations Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 18/54] drm/bridge: tfp410: Replace manual connector handling with bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 19/54] drm/bridge: tfp410: Allow operation without drm_connector Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 20/54] drm: Add helper to create a connector for a chain of bridges Laurent Pinchart
2020-02-22 15:43   ` Daniel Vetter
2020-02-22 16:50   ` [PATCH v7.1 " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 21/54] drm/omap: dss: Cleanup DSS ports on initialisation failure Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 22/54] drm/omap: Simplify HDMI mode and infoframe configuration Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 23/54] drm/omap: Factor out display type to connector type conversion Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 24/54] drm/omap: Use the drm_panel_bridge API Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 25/54] drm/omap: dss: Fix output next device lookup in DT Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 26/54] drm/omap: Add infrastructure to support drm_bridge local to DSS outputs Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 27/54] drm/omap: dss: Make omap_dss_device_ops optional Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 28/54] drm/omap: hdmi: Allocate EDID in the .read_edid() operation Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 29/54] drm/omap: hdmi4: Rework EDID read to isolate data read Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 30/54] drm/omap: hdmi5: " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 31/54] drm/omap: hdmi4: Register a drm_bridge for EDID read Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 32/54] drm/omap: hdmi5: " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 33/54] drm/omap: hdmi4: Move mode set, enable and disable operations to bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 34/54] drm/omap: hdmi5: " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 35/54] drm/omap: hdmi4: Implement drm_bridge .hpd_notify() operation Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 36/54] drm/omap: dss: Remove .set_hdmi_mode() and .set_infoframe() operations Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 37/54] drm/omap: venc: Register a drm_bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 38/54] drm/omap: Create connector for bridges Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 39/54] drm/omap: Switch the HDMI and VENC outputs to drm_bridge Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 40/54] drm/omap: Remove HPD, detect and EDID omapdss operations Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 41/54] drm/omap: hdmi: Remove omap_dss_device operations Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 42/54] drm/omap: venc: " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 43/54] drm/omap: hdmi4: Simplify EDID read Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 44/54] drm/omap: hdmi5: " Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 45/54] drm/omap: dpi: Sort includes alphabetically Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 46/54] drm/omap: dpi: Reorder functions in sections Laurent Pinchart
2020-02-22 15:00 ` [PATCH v7 47/54] drm/omap: dpi: Simplify clock setting API Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 48/54] drm/omap: dpi: Register a drm_bridge Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 49/54] drm/omap: sdi: Sort includes alphabetically Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 50/54] drm/omap: sdi: Register a drm_bridge Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 51/54] drm/omap: Hardcode omap_connector type to DSI Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 52/54] drm/omap: dss: Inline the omapdss_display_get() function Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 53/54] drm/omap: dss: Remove unused omapdss_of_find_connected_device() function Laurent Pinchart
2020-02-22 15:01 ` [PATCH v7 54/54] drm/omap: dss: Remove unused omap_dss_device operations Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200222164832.18338-1-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bbrezillon@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sam@ravnborg.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.