Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1412298 > unrolled thread
| Started by | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| First post | 2016-06-02 16:40 +0200 |
| Last post | 2016-06-02 16:40 +0200 |
| Articles | 11 on this page of 31 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 00/20] drm/atomic: Provide default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 18/20] drm/bridge: ptn3460: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 15/20] drm: virtgpu: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 10/20] drm: rockchip: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
Re: [PATCH 10/20] drm: rockchip: Rely on the default ->best_encoder() behavior Mark yao <mark.yao@rock-chips.com> - 2016-06-07 03:00 +0200
[PATCH 03/20] drm: atmel-hlcdc: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 05/20] drm: fsl-dcu: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 19/20] drm/bridge: ps8622: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 13/20] drm: tegra: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 07/20] drm: mediatek: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 17/20] drm/bridge: anx78xx: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
Re: [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:00 +0200
Re: [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
[PATCH 14/20] drm: vc4: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 08/20] drm: msm: Rely on the default ->best_encoder() behavior where appropriate Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 04/20] drm: exynos: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 16/20] drm: omap: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
Re: [PATCH 16/20] drm: omap: Rely on the default ->best_encoder() behavior Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:10 +0200
[PATCH 12/20] drm: sun4i: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 02/20] drm: arc: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 20/20] drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 06/20] drm: i915: Rely on the default ->best_encoder() behavior where appropriate Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
[PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:10 +0200
Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Daniel Vetter <daniel@ffwll.ch> - 2016-06-03 00:00 +0200
Re: [Intel-gfx] [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-03 00:50 +0200
Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Daniel Vetter <daniel@ffwll.ch> - 2016-06-03 21:10 +0200
Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
[PATCH 11/20] drm: sti: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-02 16:40 +0200 |
| Subject | [PATCH 02/20] drm: arc: Rely on the default ->best_encoder() behavior |
| Message-ID | <rFBWX-753-47@gated-at.bofh.it> |
| In reply to | #1412298 |
We have a 1:1 relationship between connectors and encoders and the
driver is relying on the atomic helpers: we can drop the custom
->best_encoder(), and let the core call drm_atomic_helper_best_encoder()
for us.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/gpu/drm/arc/arcpgu_hdmi.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c
index 08b6bae..b7a8b2a 100644
--- a/drivers/gpu/drm/arc/arcpgu_hdmi.c
+++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c
@@ -46,23 +46,6 @@ static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
return sfuncs->get_modes(&slave->base, connector);
}
-struct drm_encoder *
-arcpgu_drm_connector_best_encoder(struct drm_connector *connector)
-{
- struct drm_encoder_slave *slave;
- struct arcpgu_drm_connector *con =
- container_of(connector, struct arcpgu_drm_connector, connector);
-
- slave = con->encoder_slave;
- if (slave == NULL) {
- dev_err(connector->dev->dev,
- "connector_best_encoder: cannot find slave encoder for connector\n");
- return NULL;
- }
-
- return &slave->base;
-}
-
static enum drm_connector_status
arcpgu_drm_connector_detect(struct drm_connector *connector, bool force)
{
@@ -97,7 +80,6 @@ static void arcpgu_drm_connector_destroy(struct drm_connector *connector)
static const struct drm_connector_helper_funcs
arcpgu_drm_connector_helper_funcs = {
.get_modes = arcpgu_drm_connector_get_modes,
- .best_encoder = arcpgu_drm_connector_best_encoder,
};
static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-02 16:40 +0200 |
| Subject | [PATCH 20/20] drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder() |
| Message-ID | <rFBWX-753-49@gated-at.bofh.it> |
| In reply to | #1412298 |
We have a 1:1 relationship between connectors and encoders, which means
we can rely on the drm_atomic_helper_best_encoder() behavior.
We still have to explicitly assign ->best_encoder() to
drm_atomic_helper_best_encoder(), because the automated fallback to
drm_atomic_helper_best_encoder() when ->best_encoder() is NULL is only
available when the DRM device is using the atomic helpers, and this bridge
is compatible with non-atomic and atomic devices.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/gpu/drm/bridge/dw-hdmi.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index c9d9412..70b1f7d 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1476,15 +1476,6 @@ dw_hdmi_connector_mode_valid(struct drm_connector *connector,
return mode_status;
}
-static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
- *connector)
-{
- struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
- connector);
-
- return hdmi->encoder;
-}
-
static void dw_hdmi_connector_destroy(struct drm_connector *connector)
{
drm_connector_unregister(connector);
@@ -1525,7 +1516,7 @@ static const struct drm_connector_funcs dw_hdmi_atomic_connector_funcs = {
static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
.get_modes = dw_hdmi_connector_get_modes,
.mode_valid = dw_hdmi_connector_mode_valid,
- .best_encoder = dw_hdmi_connector_best_encoder,
+ .best_encoder = drm_atomic_helper_best_encoder,
};
static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-02 16:40 +0200 |
| Subject | [PATCH 06/20] drm: i915: Rely on the default ->best_encoder() behavior where appropriate |
| Message-ID | <rFBWX-753-51@gated-at.bofh.it> |
| In reply to | #1412298 |
For all outputs except dp_mst, we have a 1:1 relationship between
connectors and encoders and the driver is relying on the atomic helpers:
we can drop the custom ->best_encoder() implementation and let the core
call drm_atomic_helper_best_encoder() for us.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/gpu/drm/i915/intel_crt.c | 1 -
drivers/gpu/drm/i915/intel_display.c | 8 --------
drivers/gpu/drm/i915/intel_dp.c | 1 -
drivers/gpu/drm/i915/intel_drv.h | 1 -
drivers/gpu/drm/i915/intel_dsi.c | 1 -
drivers/gpu/drm/i915/intel_dvo.c | 1 -
drivers/gpu/drm/i915/intel_hdmi.c | 1 -
drivers/gpu/drm/i915/intel_lvds.c | 1 -
drivers/gpu/drm/i915/intel_sdvo.c | 1 -
drivers/gpu/drm/i915/intel_tv.c | 1 -
10 files changed, 17 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 3fbb6fc..bd0cd68 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -753,7 +753,6 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
.mode_valid = intel_crt_mode_valid,
.get_modes = intel_crt_get_modes,
- .best_encoder = intel_best_encoder,
};
static const struct drm_encoder_funcs intel_crt_enc_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2113f40..77026ce 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -16113,14 +16113,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
intel_teardown_gmbus(dev);
}
-/*
- * Return which encoder is currently attached for connector.
- */
-struct drm_encoder *intel_best_encoder(struct drm_connector *connector)
-{
- return &intel_attached_encoder(connector)->base;
-}
-
void intel_connector_attach_encoder(struct intel_connector *connector,
struct intel_encoder *encoder)
{
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f192f58..21b2833 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4935,7 +4935,6 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
.get_modes = intel_dp_get_modes,
.mode_valid = intel_dp_mode_valid,
- .best_encoder = intel_best_encoder,
};
static const struct drm_encoder_funcs intel_dp_enc_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a28b4aa..79a4d6b 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1128,7 +1128,6 @@ struct intel_connector *intel_connector_alloc(void);
bool intel_connector_get_hw_state(struct intel_connector *connector);
void intel_connector_attach_encoder(struct intel_connector *connector,
struct intel_encoder *encoder);
-struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
struct drm_crtc *crtc);
enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 366ad6c..ec51952 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1378,7 +1378,6 @@ static const struct drm_encoder_funcs intel_dsi_funcs = {
static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = {
.get_modes = intel_dsi_get_modes,
.mode_valid = intel_dsi_mode_valid,
- .best_encoder = intel_best_encoder,
};
static const struct drm_connector_funcs intel_dsi_connector_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 286baec..34b7e3f 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -351,7 +351,6 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = {
static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {
.mode_valid = intel_dvo_mode_valid,
.get_modes = intel_dvo_get_modes,
- .best_encoder = intel_best_encoder,
};
static void intel_dvo_enc_destroy(struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 2c3bd9c..aef4bc8 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2114,7 +2114,6 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
.get_modes = intel_hdmi_get_modes,
.mode_valid = intel_hdmi_mode_valid,
- .best_encoder = intel_best_encoder,
};
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index bc53c0d..d4faa5a 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -547,7 +547,6 @@ static int intel_lvds_set_property(struct drm_connector *connector,
static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = {
.get_modes = intel_lvds_get_modes,
.mode_valid = intel_lvds_mode_valid,
- .best_encoder = intel_best_encoder,
};
static const struct drm_connector_funcs intel_lvds_connector_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 2128fae..5cd48ff 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2191,7 +2191,6 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
.get_modes = intel_sdvo_get_modes,
.mode_valid = intel_sdvo_mode_valid,
- .best_encoder = intel_best_encoder,
};
static void intel_sdvo_enc_destroy(struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 223129d..47fe241 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1512,7 +1512,6 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
.mode_valid = intel_tv_mode_valid,
.get_modes = intel_tv_get_modes,
- .best_encoder = intel_best_encoder,
};
static const struct drm_encoder_funcs intel_tv_enc_funcs = {
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-02 16:40 +0200 |
| Subject | [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFBWX-753-45@gated-at.bofh.it> |
| In reply to | #1412298 |
Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
that DRM drivers can leave this hook unassigned if they know they want
to use drm_atomic_helper_best_encoder().
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index f6a3350..849d029 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state *state,
if (funcs->atomic_best_encoder)
new_encoder = funcs->atomic_best_encoder(connector,
connector_state);
- else
+ else if (funcs->best_encoder)
new_encoder = funcs->best_encoder(connector);
+ else
+ new_encoder = drm_atomic_helper_best_encoder(connector);
if (!new_encoder) {
DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 7c2eb75..d44389a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
my_score++;
connector_funcs = connector->helper_private;
- encoder = connector_funcs->best_encoder(connector);
+
+ /*
+ * If the DRM device implements atomic hooks and ->best_encoder() is
+ * NULL we fallback to the default drm_atomic_helper_best_encoder()
+ * helper.
+ */
+ if (fb_helper->dev->mode_config.funcs->atomic_commit &&
+ !connector_funcs->best_encoder)
+ encoder = drm_atomic_helper_best_encoder(connector);
+ else
+ encoder = connector_funcs->best_encoder(connector);
+
if (!encoder)
goto out;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| Date | 2016-06-02 23:10 +0200 |
| Subject | Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFI2l-2Jx-3@gated-at.bofh.it> |
| In reply to | #1412319 |
Hi Boris,
Thank you for the patch.
On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:
> Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
> drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
> that DRM drivers can leave this hook unassigned if they know they want
> to use drm_atomic_helper_best_encoder().
Could you please update include/drm/drm_modeset_helper_vtables.h to document
this new behaviour ?
The only drawback I see in this patch is the additional object lookup
performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
somehow cache the information, as the assignment can't change when there's a
1:1 correspondence between encoders and connectors.
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
> drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
> *state, if (funcs->atomic_best_encoder)
> new_encoder = funcs->atomic_best_encoder(connector,
> connector_state);
> - else
> + else if (funcs->best_encoder)
> new_encoder = funcs->best_encoder(connector);
> + else
> + new_encoder = drm_atomic_helper_best_encoder(connector);
>
> if (!new_encoder) {
> DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
> *fb_helper, my_score++;
>
> connector_funcs = connector->helper_private;
> - encoder = connector_funcs->best_encoder(connector);
> +
> + /*
> + * If the DRM device implements atomic hooks and ->best_encoder() is
> + * NULL we fallback to the default drm_atomic_helper_best_encoder()
> + * helper.
> + */
> + if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> + !connector_funcs->best_encoder)
> + encoder = drm_atomic_helper_best_encoder(connector);
> + else
> + encoder = connector_funcs->best_encoder(connector);
> +
> if (!encoder)
> goto out;
--
Regards,
Laurent Pinchart
[toc] | [prev] | [next] | [standalone]
| From | Daniel Vetter <daniel@ffwll.ch> |
|---|---|
| Date | 2016-06-03 00:00 +0200 |
| Subject | Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFIOK-305-15@gated-at.bofh.it> |
| In reply to | #1412554 |
On Thu, Jun 2, 2016 at 11:05 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Boris,
>
> Thank you for the patch.
>
> On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:
>> Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
>> drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
>> that DRM drivers can leave this hook unassigned if they know they want
>> to use drm_atomic_helper_best_encoder().
>
> Could you please update include/drm/drm_modeset_helper_vtables.h to document
> this new behaviour ?
Thanks for reminding me. Please update hooks for both
atomic_best_encoder and best_encoder. Also mention that it's only
optional for atomic drivers. There's lots of examples in that file for
the wording usually used.
> The only drawback I see in this patch is the additional object lookup
> performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
> somehow cache the information, as the assignment can't change when there's a
> 1:1 correspondence between encoders and connectors.
drm_encoder_find is an idr lookup. That should be plenty fast,
especially for modeset code. Usually what's too expensive even for
modeset code is linear list walks. But Chris just submitted patches to
convert most of them into simple lookups.
-Daniel
>>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>> ---
>> drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
>> drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
>> 2 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
>> b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
>> *state, if (funcs->atomic_best_encoder)
>> new_encoder = funcs->atomic_best_encoder(connector,
>> connector_state);
>> - else
>> + else if (funcs->best_encoder)
>> new_encoder = funcs->best_encoder(connector);
>> + else
>> + new_encoder = drm_atomic_helper_best_encoder(connector);
>>
>> if (!new_encoder) {
>> DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c
>> b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
>> *fb_helper, my_score++;
>>
>> connector_funcs = connector->helper_private;
>> - encoder = connector_funcs->best_encoder(connector);
>> +
>> + /*
>> + * If the DRM device implements atomic hooks and ->best_encoder() is
>> + * NULL we fallback to the default drm_atomic_helper_best_encoder()
>> + * helper.
>> + */
>> + if (fb_helper->dev->mode_config.funcs->atomic_commit &&
>> + !connector_funcs->best_encoder)
>> + encoder = drm_atomic_helper_best_encoder(connector);
>> + else
>> + encoder = connector_funcs->best_encoder(connector);
>> +
>> if (!encoder)
>> goto out;
>
> --
> Regards,
>
> Laurent Pinchart
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
[toc] | [prev] | [next] | [standalone]
| From | Chris Wilson <chris@chris-wilson.co.uk> |
|---|---|
| Date | 2016-06-03 00:50 +0200 |
| Subject | Re: [Intel-gfx] [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFJB7-3vM-3@gated-at.bofh.it> |
| In reply to | #1412582 |
On Thu, Jun 02, 2016 at 11:57:02PM +0200, Daniel Vetter wrote: > drm_encoder_find is an idr lookup. That should be plenty fast, > especially for modeset code. Usually what's too expensive even for > modeset code is linear list walks. But Chris just submitted patches to > convert most of them into simple lookups. For the idr_find, I'm tempted to replace the mutex with a rwlock. It helps pathological cases, but in reality there are more crucial locks around the hw that limit concurrency. ;-) -Chris -- Chris Wilson, Intel Open Source Technology Centre
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-03 09:40 +0200 |
| Subject | Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFRS1-g0-5@gated-at.bofh.it> |
| In reply to | #1412582 |
On Thu, 2 Jun 2016 23:57:02 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:
> On Thu, Jun 2, 2016 at 11:05 PM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
> > Hi Boris,
> >
> > Thank you for the patch.
> >
> > On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:
> >> Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
> >> drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
> >> that DRM drivers can leave this hook unassigned if they know they want
> >> to use drm_atomic_helper_best_encoder().
> >
> > Could you please update include/drm/drm_modeset_helper_vtables.h to document
> > this new behaviour ?
>
> Thanks for reminding me. Please update hooks for both
> atomic_best_encoder and best_encoder. Also mention that it's only
> optional for atomic drivers. There's lots of examples in that file for
> the wording usually used.
Hm, I haven't changed anything for the ->atomic_best_encoder() hook, or
am I missing something?
>
> > The only drawback I see in this patch is the additional object lookup
> > performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
> > somehow cache the information, as the assignment can't change when there's a
> > 1:1 correspondence between encoders and connectors.
>
> drm_encoder_find is an idr lookup. That should be plenty fast,
> especially for modeset code. Usually what's too expensive even for
> modeset code is linear list walks. But Chris just submitted patches to
> convert most of them into simple lookups.
> -Daniel
>
> >>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >> ---
> >> drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
> >> drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
> >> 2 files changed, 15 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> >> b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
> >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >> @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
> >> *state, if (funcs->atomic_best_encoder)
> >> new_encoder = funcs->atomic_best_encoder(connector,
> >> connector_state);
> >> - else
> >> + else if (funcs->best_encoder)
> >> new_encoder = funcs->best_encoder(connector);
> >> + else
> >> + new_encoder = drm_atomic_helper_best_encoder(connector);
> >>
> >> if (!new_encoder) {
> >> DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> >> b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
> >> *fb_helper, my_score++;
> >>
> >> connector_funcs = connector->helper_private;
> >> - encoder = connector_funcs->best_encoder(connector);
> >> +
> >> + /*
> >> + * If the DRM device implements atomic hooks and ->best_encoder() is
> >> + * NULL we fallback to the default drm_atomic_helper_best_encoder()
> >> + * helper.
> >> + */
> >> + if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> >> + !connector_funcs->best_encoder)
> >> + encoder = drm_atomic_helper_best_encoder(connector);
> >> + else
> >> + encoder = connector_funcs->best_encoder(connector);
> >> +
> >> if (!encoder)
> >> goto out;
> >
> > --
> > Regards,
> >
> > Laurent Pinchart
> >
>
>
>
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Daniel Vetter <daniel@ffwll.ch> |
|---|---|
| Date | 2016-06-03 21:10 +0200 |
| Subject | Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rG2DL-7cv-1@gated-at.bofh.it> |
| In reply to | #1412867 |
On Fri, Jun 03, 2016 at 09:37:43AM +0200, Boris Brezillon wrote:
> On Thu, 2 Jun 2016 23:57:02 +0200
> Daniel Vetter <daniel@ffwll.ch> wrote:
>
> > On Thu, Jun 2, 2016 at 11:05 PM, Laurent Pinchart
> > <laurent.pinchart@ideasonboard.com> wrote:
> > > Hi Boris,
> > >
> > > Thank you for the patch.
> > >
> > > On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:
> > >> Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
> > >> drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
> > >> that DRM drivers can leave this hook unassigned if they know they want
> > >> to use drm_atomic_helper_best_encoder().
> > >
> > > Could you please update include/drm/drm_modeset_helper_vtables.h to document
> > > this new behaviour ?
> >
> > Thanks for reminding me. Please update hooks for both
> > atomic_best_encoder and best_encoder. Also mention that it's only
> > optional for atomic drivers. There's lots of examples in that file for
> > the wording usually used.
>
> Hm, I haven't changed anything for the ->atomic_best_encoder() hook, or
> am I missing something?
Before you needed atomic_best_encoder or best_encoder (well that's the
idea at least), now both are optional. Kerneldoc needs to be adjusted in
both places to match new reality after your patch.
-Daniel
>
> >
> > > The only drawback I see in this patch is the additional object lookup
> > > performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
> > > somehow cache the information, as the assignment can't change when there's a
> > > 1:1 correspondence between encoders and connectors.
> >
> > drm_encoder_find is an idr lookup. That should be plenty fast,
> > especially for modeset code. Usually what's too expensive even for
> > modeset code is linear list walks. But Chris just submitted patches to
> > convert most of them into simple lookups.
> > -Daniel
> >
> > >>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > >> ---
> > >> drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
> > >> drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
> > >> 2 files changed, 15 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > >> b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
> > >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> > >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > >> @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
> > >> *state, if (funcs->atomic_best_encoder)
> > >> new_encoder = funcs->atomic_best_encoder(connector,
> > >> connector_state);
> > >> - else
> > >> + else if (funcs->best_encoder)
> > >> new_encoder = funcs->best_encoder(connector);
> > >> + else
> > >> + new_encoder = drm_atomic_helper_best_encoder(connector);
> > >>
> > >> if (!new_encoder) {
> > >> DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> > >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> > >> b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
> > >> --- a/drivers/gpu/drm/drm_fb_helper.c
> > >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> > >> @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
> > >> *fb_helper, my_score++;
> > >>
> > >> connector_funcs = connector->helper_private;
> > >> - encoder = connector_funcs->best_encoder(connector);
> > >> +
> > >> + /*
> > >> + * If the DRM device implements atomic hooks and ->best_encoder() is
> > >> + * NULL we fallback to the default drm_atomic_helper_best_encoder()
> > >> + * helper.
> > >> + */
> > >> + if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> > >> + !connector_funcs->best_encoder)
> > >> + encoder = drm_atomic_helper_best_encoder(connector);
> > >> + else
> > >> + encoder = connector_funcs->best_encoder(connector);
> > >> +
> > >> if (!encoder)
> > >> goto out;
> > >
> > > --
> > > Regards,
> > >
> > > Laurent Pinchart
> > >
> >
> >
> >
>
>
>
> --
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-03 09:40 +0200 |
| Subject | Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid |
| Message-ID | <rFRS1-g0-11@gated-at.bofh.it> |
| In reply to | #1412554 |
On Fri, 03 Jun 2016 00:05:46 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:
> Hi Boris,
>
> Thank you for the patch.
>
> On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:
> > Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
> > drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
> > that DRM drivers can leave this hook unassigned if they know they want
> > to use drm_atomic_helper_best_encoder().
>
> Could you please update include/drm/drm_modeset_helper_vtables.h to document
> this new behaviour ?
Sure.
>
> The only drawback I see in this patch is the additional object lookup
> performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
> somehow cache the information, as the assignment can't change when there's a
> 1:1 correspondence between encoders and connectors.
>
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
> > drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++-
> > 2 files changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
> > *state, if (funcs->atomic_best_encoder)
> > new_encoder = funcs->atomic_best_encoder(connector,
> > connector_state);
> > - else
> > + else if (funcs->best_encoder)
> > new_encoder = funcs->best_encoder(connector);
> > + else
> > + new_encoder = drm_atomic_helper_best_encoder(connector);
> >
> > if (!new_encoder) {
> > DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c
> > b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
> > *fb_helper, my_score++;
> >
> > connector_funcs = connector->helper_private;
> > - encoder = connector_funcs->best_encoder(connector);
> > +
> > + /*
> > + * If the DRM device implements atomic hooks and ->best_encoder() is
> > + * NULL we fallback to the default drm_atomic_helper_best_encoder()
> > + * helper.
> > + */
> > + if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> > + !connector_funcs->best_encoder)
> > + encoder = drm_atomic_helper_best_encoder(connector);
> > + else
> > + encoder = connector_funcs->best_encoder(connector);
> > +
> > if (!encoder)
> > goto out;
>
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-02 16:40 +0200 |
| Subject | [PATCH 11/20] drm: sti: Rely on the default ->best_encoder() behavior |
| Message-ID | <rFBWX-753-59@gated-at.bofh.it> |
| In reply to | #1412298 |
All outputs have a 1:1 relationship between connectors and encoders
and the driver is relying on the atomic helpers: we can drop the custom
->best_encoder() implementations and let the core call
drm_atomic_helper_best_encoder() for us.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/gpu/drm/sti/sti_dvo.c | 10 ----------
drivers/gpu/drm/sti/sti_hda.c | 10 ----------
drivers/gpu/drm/sti/sti_hdmi.c | 10 ----------
3 files changed, 30 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 25f7663..d5627d1 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -384,20 +384,10 @@ static int sti_dvo_connector_mode_valid(struct drm_connector *connector,
return MODE_OK;
}
-struct drm_encoder *sti_dvo_best_encoder(struct drm_connector *connector)
-{
- struct sti_dvo_connector *dvo_connector
- = to_sti_dvo_connector(connector);
-
- /* Best encoder is the one associated during connector creation */
- return dvo_connector->encoder;
-}
-
static const
struct drm_connector_helper_funcs sti_dvo_connector_helper_funcs = {
.get_modes = sti_dvo_connector_get_modes,
.mode_valid = sti_dvo_connector_mode_valid,
- .best_encoder = sti_dvo_best_encoder,
};
static enum drm_connector_status
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index f7d3464..c4649f5 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -676,20 +676,10 @@ static int sti_hda_connector_mode_valid(struct drm_connector *connector,
return MODE_OK;
}
-struct drm_encoder *sti_hda_best_encoder(struct drm_connector *connector)
-{
- struct sti_hda_connector *hda_connector
- = to_sti_hda_connector(connector);
-
- /* Best encoder is the one associated during connector creation */
- return hda_connector->encoder;
-}
-
static const
struct drm_connector_helper_funcs sti_hda_connector_helper_funcs = {
.get_modes = sti_hda_connector_get_modes,
.mode_valid = sti_hda_connector_mode_valid,
- .best_encoder = sti_hda_best_encoder,
};
static enum drm_connector_status
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 6ef0715..dc9ab6e 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -897,20 +897,10 @@ static int sti_hdmi_connector_mode_valid(struct drm_connector *connector,
return MODE_OK;
}
-struct drm_encoder *sti_hdmi_best_encoder(struct drm_connector *connector)
-{
- struct sti_hdmi_connector *hdmi_connector
- = to_sti_hdmi_connector(connector);
-
- /* Best encoder is the one associated during connector creation */
- return hdmi_connector->encoder;
-}
-
static const
struct drm_connector_helper_funcs sti_hdmi_connector_helper_funcs = {
.get_modes = sti_hdmi_connector_get_modes,
.mode_valid = sti_hdmi_connector_mode_valid,
- .best_encoder = sti_hdmi_best_encoder,
};
/* get detection status of display device */
--
2.7.4
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web