From: Samuel Holland <samuel@sholland.org>
To: Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maxime Ripard <mripard@kernel.org>
Cc: Samuel Holland <samuel@sholland.org>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: [PATCH v3 06/14] sun4i/drm: engine: Add mode_set callback
Date: Sun, 24 Apr 2022 11:26:24 -0500 [thread overview]
Message-ID: <20220424162633.12369-7-samuel@sholland.org> (raw)
In-Reply-To: <20220424162633.12369-1-samuel@sholland.org>
From: Jernej Skrabec <jernej.skrabec@gmail.com>
This optional callback is useful for setting properties which depends
only on current mode. Such properties are width, height and interlaced
output.
These properties are currently set in update layer callback for primary
plane which is less than ideal. More about that in follow up patches,
which will migrate that code to this newly defined callback.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
(no changes since v2)
Changes in v2:
- Use Jernej's patches for mixer mode setting.
drivers/gpu/drm/sun4i/sun4i_crtc.c | 1 +
drivers/gpu/drm/sun4i/sunxi_engine.h | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 45d9eb552d86..c06d7cd45388 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -146,6 +146,7 @@ static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc)
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
sun4i_tcon_mode_set(scrtc->tcon, encoder, mode);
+ sunxi_engine_mode_set(scrtc->engine, mode);
}
static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h
index 548710a936d5..ec8cf9b2bda4 100644
--- a/drivers/gpu/drm/sun4i/sunxi_engine.h
+++ b/drivers/gpu/drm/sun4i/sunxi_engine.h
@@ -9,6 +9,7 @@
struct drm_plane;
struct drm_device;
struct drm_crtc_state;
+struct drm_display_mode;
struct sunxi_engine;
@@ -108,6 +109,17 @@ struct sunxi_engine_ops {
* This function is optional.
*/
void (*vblank_quirk)(struct sunxi_engine *engine);
+
+ /**
+ * @mode_set
+ *
+ * This callback is used to set mode related parameters
+ * like interlacing, screen size, etc. once per mode set.
+ *
+ * This function is optional.
+ */
+ void (*mode_set)(struct sunxi_engine *engine,
+ const struct drm_display_mode *mode);
};
/**
@@ -181,4 +193,19 @@ sunxi_engine_disable_color_correction(struct sunxi_engine *engine)
if (engine->ops && engine->ops->disable_color_correction)
engine->ops->disable_color_correction(engine);
}
+
+/**
+ * sunxi_engine_mode_set - Inform engine of a new mode
+ * @engine: pointer to the engine
+ * @mode: new mode
+ *
+ * Engine can use this functionality to set specifics once per mode change.
+ */
+static inline void
+sunxi_engine_mode_set(struct sunxi_engine *engine,
+ const struct drm_display_mode *mode)
+{
+ if (engine->ops && engine->ops->mode_set)
+ engine->ops->mode_set(engine, mode);
+}
#endif /* _SUNXI_ENGINE_H_ */
--
2.35.1
next prev parent reply other threads:[~2022-04-24 16:26 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 16:26 [PATCH v3 00/14] drm/sun4i: Allwinner D1 Display Engine 2.0 Support Samuel Holland
2022-04-24 16:26 ` [PATCH v3 01/14] dt-bindings: display: Separate clock item lists by compatible Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 02/14] dt-bindings: display: Add D1 display engine compatibles Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 03/14] drm/sun4i: Remove obsolete references to PHYS_OFFSET Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 04/14] drm/sun4i: hdmi: Use more portable I/O helpers Samuel Holland
2022-04-24 19:59 ` Jernej Škrabec
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 05/14] drm/sun4i: Allow building the driver on RISC-V Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` Samuel Holland [this message]
2022-04-26 12:41 ` (subset) [PATCH v3 06/14] sun4i/drm: engine: Add mode_set callback Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 07/14] sun4i/drm: backend: use mode_set engine callback Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 08/14] sun4i/drm: sun8i: " Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 09/14] drm/sun4i: Allow VI layers to be primary planes Samuel Holland
2022-04-24 20:01 ` Jernej Škrabec
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 10/14] drm/sun4i: csc: Add support for the new MMIO layout Samuel Holland
2022-04-24 20:02 ` Jernej Škrabec
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 11/14] drm/sun4i: Add support for D1 mixers Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 12/14] drm/sun4i: Add support for D1 TCON TOP Samuel Holland
2022-04-24 20:06 ` Jernej Škrabec
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 13/14] drm/sun4i: Add support for D1 TCONs Samuel Holland
2022-04-24 20:08 ` Jernej Škrabec
2022-04-26 12:41 ` (subset) " Maxime Ripard
2022-04-24 16:26 ` [PATCH v3 14/14] drm/sun4i: Add compatible for D1 display engine Samuel Holland
2022-04-26 12:41 ` (subset) " Maxime Ripard
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=20220424162633.12369-7-samuel@sholland.org \
--to=samuel@sholland.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=robh+dt@kernel.org \
--cc=wens@csie.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox