Boris Brezillon
2016-Jun-07 11:47 UTC
[PATCH v2 00/20] drm/atomic: Provide default ->best_encoder() behavior
Hello, This patch series aims at replacing all dummy ->best_encoder() implementations where we have a 1:1 relationship between encoders and connectors. The core already provides the drm_atomic_helper_best_encoder() function which is taking the first encoder attached to the connector (after making sure only one encoder was attached to the connector), but it's not automatically used, and drivers wanting to rely on this default behavior have to explicitly assign their ->best_encoder() hook to drm_atomic_helper_best_encoder(). The first patch fixes remaining places where drm_atomic_helper_best_encoder() should be called when ->best_encoder() is NULL, so that drivers using the atomic helpers can get rid of the explicit ->best_encoder assignment if they need to rely on the default drm_atomic_helper_best_encoder() implementation. The following patches are killing all open coded ->best_encoder() implementations that could be replaced by drm_atomic_helper_best_encoder(). All modifications have been compile tested except for the changed on the intel driver. I've also tested on an atmel board, but I recommend waiting for DRM driver maintainers feedback before applying the associated changes. Note that once patch 1 is applied, the other patches can be applied independently. Best Regards, Boris Changes since v1: - remove useless ->encoder backpointers in some implementations - documented the default behavior in the vtable doc - added R-b/A-b tags Boris Brezillon (20): drm/atomic: Fix remaining places where !funcs->best_encoder is valid drm: arc: Rely on the default ->best_encoder() behavior drm: atmel-hlcdc: Rely on the default ->best_encoder() behavior drm: exynos: Rely on the default ->best_encoder() behavior drm: fsl-dcu: Rely on the default ->best_encoder() behavior drm: i915: Rely on the default ->best_encoder() behavior where appropriate drm: mediatek: Rely on the default ->best_encoder() behavior drm: msm: Rely on the default ->best_encoder() behavior where appropriate drm: rcar-du: Rely on the default ->best_encoder() behavior drm: rockchip: Rely on the default ->best_encoder() behavior drm: sti: Rely on the default ->best_encoder() behavior drm: sun4i: Rely on the default ->best_encoder() behavior drm: tegra: Rely on the default ->best_encoder() behavior drm: vc4: Rely on the default ->best_encoder() behavior drm: virtgpu: Rely on the default ->best_encoder() behavior drm: omap: Rely on the default ->best_encoder() behavior drm/bridge: anx78xx: Rely on the default ->best_encoder() behavior drm/bridge: ptn3460: Rely on the default ->best_encoder() behavior drm/bridge: ps8622: Rely on the default ->best_encoder() behavior drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder() drivers/gpu/drm/arc/arcpgu_hdmi.c | 18 ------------------ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ------------ drivers/gpu/drm/bridge/analogix-anx78xx.c | 8 -------- drivers/gpu/drm/bridge/dw-hdmi.c | 11 +---------- drivers/gpu/drm/bridge/nxp-ptn3460.c | 8 -------- drivers/gpu/drm/bridge/parade-ps8622.c | 10 ---------- drivers/gpu/drm/drm_atomic_helper.c | 4 +++- drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 9 --------- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 9 --------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 -------- drivers/gpu/drm/exynos/exynos_hdmi.c | 8 -------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 9 --------- 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 - drivers/gpu/drm/mediatek/mtk_dsi.c | 9 --------- drivers/gpu/drm/msm/edp/edp_connector.c | 10 ---------- drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 8 -------- drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c | 9 --------- drivers/gpu/drm/omapdrm/omap_connector.c | 10 ---------- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 12 ------------ drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 3 --- drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 9 --------- drivers/gpu/drm/rockchip/inno_hdmi.c | 9 --------- drivers/gpu/drm/sti/sti_dvo.c | 10 ---------- drivers/gpu/drm/sti/sti_hda.c | 10 ---------- drivers/gpu/drm/sti/sti_hdmi.c | 10 ---------- drivers/gpu/drm/sun4i/sun4i_rgb.c | 10 ---------- drivers/gpu/drm/sun4i/sun4i_tv.c | 9 --------- drivers/gpu/drm/tegra/drm.h | 2 -- drivers/gpu/drm/tegra/dsi.c | 1 - drivers/gpu/drm/tegra/hdmi.c | 1 - drivers/gpu/drm/tegra/output.c | 8 -------- drivers/gpu/drm/tegra/rgb.c | 1 - drivers/gpu/drm/tegra/sor.c | 1 - drivers/gpu/drm/vc4/vc4_dpi.c | 9 --------- drivers/gpu/drm/vc4/vc4_hdmi.c | 9 --------- drivers/gpu/drm/virtio/virtgpu_display.c | 10 ---------- include/drm/drm_modeset_helper_vtables.h | 10 ++++++++-- 50 files changed, 24 insertions(+), 305 deletions(-) -- 2.7.4
Boris Brezillon
2016-Jun-07 11:47 UTC
[PATCH v2 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid
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(). Update the vtables documentation accordingly. Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com> --- drivers/gpu/drm/drm_atomic_helper.c | 4 +++- drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++- include/drm/drm_modeset_helper_vtables.h | 10 ++++++++-- 3 files changed, 23 insertions(+), 4 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; diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index d4619dc..4e7a53b 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -736,6 +736,11 @@ struct drm_connector_helper_funcs { * inspect dynamic configuration state should instead use * @atomic_best_encoder. * + * You can leave this function to NULL if the connector is only + * attached to a single encoder and you are using the atomic helpers. + * In this case, the core will call drm_atomic_helper_best_encoder() + * for you. + * * RETURNS: * * Encoder that should be used for the given connector and connector @@ -752,8 +757,9 @@ struct drm_connector_helper_funcs { * need to select the best encoder depending upon the desired * configuration and can't select it statically. * - * This function is used by drm_atomic_helper_check_modeset() and either - * this or @best_encoder is required. + * This function is used by drm_atomic_helper_check_modeset(). + * If it is not implemented, the core will fallback to @best_encoder + * (or drm_atomic_helper_best_encoder() if @best_encoder is NULL). * * NOTE: * -- 2.7.4
Boris Brezillon
2016-Jun-07 11:47 UTC
[PATCH v2 02/20] drm: arc: Rely on the default ->best_encoder() behavior
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 at 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
Boris Brezillon
2016-Jun-07 11:47 UTC
[PATCH v2 03/20] drm: atmel-hlcdc: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 3d34fc4..6119b50 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c @@ -113,21 +113,9 @@ static int atmel_hlcdc_rgb_mode_valid(struct drm_connector *connector, return atmel_hlcdc_dc_mode_valid(rgb->dc, mode); } - - -static struct drm_encoder * -atmel_hlcdc_rgb_best_encoder(struct drm_connector *connector) -{ - struct atmel_hlcdc_rgb_output *rgb - drm_connector_to_atmel_hlcdc_rgb_output(connector); - - return &rgb->encoder; -} - static const struct drm_connector_helper_funcs atmel_hlcdc_panel_connector_helper_funcs = { .get_modes = atmel_hlcdc_panel_get_modes, .mode_valid = atmel_hlcdc_rgb_mode_valid, - .best_encoder = atmel_hlcdc_rgb_best_encoder, }; static enum drm_connector_status -- 2.7.4
Boris Brezillon
2016-Jun-07 11:47 UTC
[PATCH v2 04/20] drm: exynos: Rely on the default ->best_encoder() behavior
We have 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 at free-electrons.com> --- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 9 --------- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 9 --------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 -------- drivers/gpu/drm/exynos/exynos_hdmi.c | 8 -------- 4 files changed, 34 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 5e38e74..ad6b73c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -93,17 +93,8 @@ static int exynos_dpi_get_modes(struct drm_connector *connector) return 0; } -static struct drm_encoder * -exynos_dpi_best_encoder(struct drm_connector *connector) -{ - struct exynos_dpi *ctx = connector_to_dpi(connector); - - return &ctx->encoder; -} - static const struct drm_connector_helper_funcs exynos_dpi_connector_helper_funcs = { .get_modes = exynos_dpi_get_modes, - .best_encoder = exynos_dpi_best_encoder, }; static int exynos_dpi_create_connector(struct drm_encoder *encoder) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 601ecf8..e07cb1f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1566,17 +1566,8 @@ static int exynos_dsi_get_modes(struct drm_connector *connector) return 0; } -static struct drm_encoder * -exynos_dsi_best_encoder(struct drm_connector *connector) -{ - struct exynos_dsi *dsi = connector_to_dsi(connector); - - return &dsi->encoder; -} - static const struct drm_connector_helper_funcs exynos_dsi_connector_helper_funcs = { .get_modes = exynos_dsi_get_modes, - .best_encoder = exynos_dsi_best_encoder, }; static int exynos_dsi_create_connector(struct drm_encoder *encoder) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 608b0af..e8f6c92 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -378,16 +378,8 @@ static int vidi_get_modes(struct drm_connector *connector) return drm_add_edid_modes(connector, edid); } -static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector) -{ - struct vidi_context *ctx = ctx_from_connector(connector); - - return &ctx->encoder; -} - static const struct drm_connector_helper_funcs vidi_connector_helper_funcs = { .get_modes = vidi_get_modes, - .best_encoder = vidi_best_encoder, }; static int vidi_create_connector(struct drm_encoder *encoder) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 58de5a4..1625d7c 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -937,17 +937,9 @@ static int hdmi_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder *hdmi_best_encoder(struct drm_connector *connector) -{ - struct hdmi_context *hdata = connector_to_hdmi(connector); - - return &hdata->encoder; -} - static const struct drm_connector_helper_funcs hdmi_connector_helper_funcs = { .get_modes = hdmi_get_modes, .mode_valid = hdmi_mode_valid, - .best_encoder = hdmi_best_encoder, }; static int hdmi_create_connector(struct drm_encoder *encoder) -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 05/20] drm: fsl-dcu: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c index 98c998d..0b0989e 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c @@ -102,14 +102,6 @@ static const struct drm_connector_funcs fsl_dcu_drm_connector_funcs = { .reset = drm_atomic_helper_connector_reset, }; -static struct drm_encoder * -fsl_dcu_drm_connector_best_encoder(struct drm_connector *connector) -{ - struct fsl_dcu_drm_connector *fsl_con = to_fsl_dcu_connector(connector); - - return fsl_con->encoder; -} - static int fsl_dcu_drm_connector_get_modes(struct drm_connector *connector) { struct fsl_dcu_drm_connector *fsl_connector; @@ -136,7 +128,6 @@ static int fsl_dcu_drm_connector_mode_valid(struct drm_connector *connector, } static const struct drm_connector_helper_funcs connector_helper_funcs = { - .best_encoder = fsl_dcu_drm_connector_best_encoder, .get_modes = fsl_dcu_drm_connector_get_modes, .mode_valid = fsl_dcu_drm_connector_mode_valid, }; -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 06/20] drm: i915: Rely on the default ->best_encoder() behavior where appropriate
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 at 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
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 07/20] drm: mediatek: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/mediatek/mtk_dsi.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 2d808e5..7343ffc 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -575,14 +575,6 @@ static int mtk_dsi_connector_get_modes(struct drm_connector *connector) return drm_panel_get_modes(dsi->panel); } -static struct drm_encoder *mtk_dsi_connector_best_encoder( - struct drm_connector *connector) -{ - struct mtk_dsi *dsi = connector_to_dsi(connector); - - return &dsi->encoder; -} - static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = { .mode_fixup = mtk_dsi_encoder_mode_fixup, .mode_set = mtk_dsi_encoder_mode_set, @@ -603,7 +595,6 @@ static const struct drm_connector_funcs mtk_dsi_connector_funcs = { static const struct drm_connector_helper_funcs mtk_dsi_connector_helper_funcs = { .get_modes = mtk_dsi_connector_get_modes, - .best_encoder = mtk_dsi_connector_best_encoder, }; static int mtk_drm_attach_bridge(struct drm_bridge *bridge, -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 08/20] drm: msm: Rely on the default ->best_encoder() behavior where appropriate
For all outputs except DSI 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 at free-electrons.com> --- drivers/gpu/drm/msm/edp/edp_connector.c | 10 ---------- drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 8 -------- drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c | 9 --------- 3 files changed, 27 deletions(-) diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c index 72360cd..5960628 100644 --- a/drivers/gpu/drm/msm/edp/edp_connector.c +++ b/drivers/gpu/drm/msm/edp/edp_connector.c @@ -91,15 +91,6 @@ static int edp_connector_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder * -edp_connector_best_encoder(struct drm_connector *connector) -{ - struct edp_connector *edp_connector = to_edp_connector(connector); - - DBG(""); - return edp_connector->edp->encoder; -} - static const struct drm_connector_funcs edp_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .detect = edp_connector_detect, @@ -113,7 +104,6 @@ static const struct drm_connector_funcs edp_connector_funcs = { static const struct drm_connector_helper_funcs edp_connector_helper_funcs = { .get_modes = edp_connector_get_modes, .mode_valid = edp_connector_mode_valid, - .best_encoder = edp_connector_best_encoder, }; /* initialize connector */ diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index b15d726..a2515b4 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c @@ -406,13 +406,6 @@ static int msm_hdmi_connector_mode_valid(struct drm_connector *connector, return 0; } -static struct drm_encoder * -msm_hdmi_connector_best_encoder(struct drm_connector *connector) -{ - struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); - return hdmi_connector->hdmi->encoder; -} - static const struct drm_connector_funcs hdmi_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .detect = hdmi_connector_detect, @@ -426,7 +419,6 @@ static const struct drm_connector_funcs hdmi_connector_funcs = { static const struct drm_connector_helper_funcs msm_hdmi_connector_helper_funcs = { .get_modes = msm_hdmi_connector_get_modes, .mode_valid = msm_hdmi_connector_mode_valid, - .best_encoder = msm_hdmi_connector_best_encoder, }; /* initialize connector */ diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c index 2648cd7..353429b 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c @@ -90,14 +90,6 @@ static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder * -mdp4_lvds_connector_best_encoder(struct drm_connector *connector) -{ - struct mdp4_lvds_connector *mdp4_lvds_connector - to_mdp4_lvds_connector(connector); - return mdp4_lvds_connector->encoder; -} - static const struct drm_connector_funcs mdp4_lvds_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .detect = mdp4_lvds_connector_detect, @@ -111,7 +103,6 @@ static const struct drm_connector_funcs mdp4_lvds_connector_funcs = { static const struct drm_connector_helper_funcs mdp4_lvds_connector_helper_funcs = { .get_modes = mdp4_lvds_connector_get_modes, .mode_valid = mdp4_lvds_connector_mode_valid, - .best_encoder = mdp4_lvds_connector_best_encoder, }; /* initialize connector */ -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com> --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 12 ------------ drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 3 --- drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 --- 5 files changed, 20 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 4e939e4..55149e9 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -27,18 +27,6 @@ #include "rcar_du_vgacon.h" /* ----------------------------------------------------------------------------- - * Common connector functions - */ - -struct drm_encoder * -rcar_du_connector_best_encoder(struct drm_connector *connector) -{ - struct rcar_du_connector *rcon = to_rcar_connector(connector); - - return rcar_encoder_to_drm_encoder(rcon->encoder); -} - -/* ----------------------------------------------------------------------------- * Encoder */ diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h index 719b6f2a..a8669c3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h @@ -49,9 +49,6 @@ struct rcar_du_connector { #define to_rcar_connector(c) \ container_of(c, struct rcar_du_connector, connector) -struct drm_encoder * -rcar_du_connector_best_encoder(struct drm_connector *connector); - int rcar_du_encoder_init(struct rcar_du_device *rcdu, enum rcar_du_encoder_type type, enum rcar_du_output output, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c index 6c92714..612b4d5 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c @@ -52,7 +52,6 @@ static int rcar_du_hdmi_connector_mode_valid(struct drm_connector *connector, static const struct drm_connector_helper_funcs connector_helper_funcs = { .get_modes = rcar_du_hdmi_connector_get_modes, .mode_valid = rcar_du_hdmi_connector_mode_valid, - .best_encoder = rcar_du_connector_best_encoder, }; static enum drm_connector_status diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index e905f5d..6afd0af 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c @@ -59,7 +59,6 @@ static int rcar_du_lvds_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_helper_funcs connector_helper_funcs = { .get_modes = rcar_du_lvds_connector_get_modes, - .best_encoder = rcar_du_connector_best_encoder, }; static enum drm_connector_status diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c index 9d7e5c9..8d6125c 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c @@ -28,7 +28,6 @@ static int rcar_du_vga_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_helper_funcs connector_helper_funcs = { .get_modes = rcar_du_vga_connector_get_modes, - .best_encoder = rcar_du_connector_best_encoder, }; static enum drm_connector_status @@ -79,7 +78,5 @@ int rcar_du_vga_connector_init(struct rcar_du_device *rcdu, if (ret < 0) return ret; - rcon->encoder = renc; - return 0; } -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 10/20] drm: rockchip: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> Acked-by: Mark Yao <mark.yao at rock-chips.com> --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 9 --------- drivers/gpu/drm/rockchip/inno_hdmi.c | 9 --------- 2 files changed, 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index dedc65b..ca22e5e 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -964,18 +964,9 @@ static enum drm_mode_status dw_mipi_dsi_mode_valid( return mode_status; } -static struct drm_encoder *dw_mipi_dsi_connector_best_encoder( - struct drm_connector *connector) -{ - struct dw_mipi_dsi *dsi = con_to_dsi(connector); - - return &dsi->encoder; -} - static struct drm_connector_helper_funcs dw_mipi_dsi_connector_helper_funcs = { .get_modes = dw_mipi_dsi_connector_get_modes, .mode_valid = dw_mipi_dsi_mode_valid, - .best_encoder = dw_mipi_dsi_connector_best_encoder, }; static enum drm_connector_status diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index f8b4feb..006260d 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -579,14 +579,6 @@ inno_hdmi_connector_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder * -inno_hdmi_connector_best_encoder(struct drm_connector *connector) -{ - struct inno_hdmi *hdmi = to_inno_hdmi(connector); - - return &hdmi->encoder; -} - static int inno_hdmi_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY) @@ -613,7 +605,6 @@ static struct drm_connector_funcs inno_hdmi_connector_funcs = { static struct drm_connector_helper_funcs inno_hdmi_connector_helper_funcs = { .get_modes = inno_hdmi_connector_get_modes, .mode_valid = inno_hdmi_connector_mode_valid, - .best_encoder = inno_hdmi_connector_best_encoder, }; static int inno_hdmi_register(struct drm_device *drm, struct inno_hdmi *hdmi) -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 11/20] drm: sti: Rely on the default ->best_encoder() behavior
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 at 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
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 12/20] drm: sun4i: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/sun4i/sun4i_rgb.c | 10 ---------- drivers/gpu/drm/sun4i/sun4i_tv.c | 9 --------- 2 files changed, 19 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index ab64948..442cfe2 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -90,19 +90,9 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder * -sun4i_rgb_best_encoder(struct drm_connector *connector) -{ - struct sun4i_rgb *rgb - drm_connector_to_sun4i_rgb(connector); - - return &rgb->encoder; -} - static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = { .get_modes = sun4i_rgb_get_modes, .mode_valid = sun4i_rgb_mode_valid, - .best_encoder = sun4i_rgb_best_encoder, }; static enum drm_connector_status diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index bc047f9..b841478 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -526,18 +526,9 @@ static int sun4i_tv_comp_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_encoder * -sun4i_tv_comp_best_encoder(struct drm_connector *connector) -{ - struct sun4i_tv *tv = drm_connector_to_sun4i_tv(connector); - - return &tv->encoder; -} - static struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_funcs = { .get_modes = sun4i_tv_comp_get_modes, .mode_valid = sun4i_tv_comp_mode_valid, - .best_encoder = sun4i_tv_comp_best_encoder, }; static enum drm_connector_status -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 13/20] drm: tegra: Rely on the default ->best_encoder() behavior
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() implementation and let the core call drm_atomic_helper_best_encoder() for us. Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com> --- drivers/gpu/drm/tegra/drm.h | 2 -- drivers/gpu/drm/tegra/dsi.c | 1 - drivers/gpu/drm/tegra/hdmi.c | 1 - drivers/gpu/drm/tegra/output.c | 8 -------- drivers/gpu/drm/tegra/rgb.c | 1 - drivers/gpu/drm/tegra/sor.c | 1 - 6 files changed, 14 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index f52d6cb2..0ddcce1 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -239,8 +239,6 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output); void tegra_output_exit(struct tegra_output *output); int tegra_output_connector_get_modes(struct drm_connector *connector); -struct drm_encoder * -tegra_output_connector_best_encoder(struct drm_connector *connector); enum drm_connector_status tegra_output_connector_detect(struct drm_connector *connector, bool force); void tegra_output_connector_destroy(struct drm_connector *connector); diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index d1239eb..099cccb 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -794,7 +794,6 @@ tegra_dsi_connector_mode_valid(struct drm_connector *connector, static const struct drm_connector_helper_funcs tegra_dsi_connector_helper_funcs = { .get_modes = tegra_output_connector_get_modes, .mode_valid = tegra_dsi_connector_mode_valid, - .best_encoder = tegra_output_connector_best_encoder, }; static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = { diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index b7ef492..2fdb879 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -806,7 +806,6 @@ static const struct drm_connector_helper_funcs tegra_hdmi_connector_helper_funcs = { .get_modes = tegra_output_connector_get_modes, .mode_valid = tegra_hdmi_connector_mode_valid, - .best_encoder = tegra_output_connector_best_encoder, }; static const struct drm_encoder_funcs tegra_hdmi_encoder_funcs = { diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 46664b6..1480f6a 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -42,14 +42,6 @@ int tegra_output_connector_get_modes(struct drm_connector *connector) return err; } -struct drm_encoder * -tegra_output_connector_best_encoder(struct drm_connector *connector) -{ - struct tegra_output *output = connector_to_output(connector); - - return &output->encoder; -} - enum drm_connector_status tegra_output_connector_detect(struct drm_connector *connector, bool force) { diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index e246334..a131b44 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -112,7 +112,6 @@ tegra_rgb_connector_mode_valid(struct drm_connector *connector, static const struct drm_connector_helper_funcs tegra_rgb_connector_helper_funcs = { .get_modes = tegra_output_connector_get_modes, .mode_valid = tegra_rgb_connector_mode_valid, - .best_encoder = tegra_output_connector_best_encoder, }; static const struct drm_encoder_funcs tegra_rgb_encoder_funcs = { diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 757c6e8..34958d7 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -1087,7 +1087,6 @@ tegra_sor_connector_mode_valid(struct drm_connector *connector, static const struct drm_connector_helper_funcs tegra_sor_connector_helper_funcs = { .get_modes = tegra_sor_connector_get_modes, .mode_valid = tegra_sor_connector_mode_valid, - .best_encoder = tegra_output_connector_best_encoder, }; static const struct drm_encoder_funcs tegra_sor_encoder_funcs = { -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 14/20] drm: vc4: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/vc4/vc4_dpi.c | 9 --------- drivers/gpu/drm/vc4/vc4_hdmi.c | 9 --------- 2 files changed, 18 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c index 9817dbf..dba1114 100644 --- a/drivers/gpu/drm/vc4/vc4_dpi.c +++ b/drivers/gpu/drm/vc4/vc4_dpi.c @@ -208,14 +208,6 @@ static int vc4_dpi_connector_get_modes(struct drm_connector *connector) return 0; } -static struct drm_encoder * -vc4_dpi_connector_best_encoder(struct drm_connector *connector) -{ - struct vc4_dpi_connector *dpi_connector - to_vc4_dpi_connector(connector); - return dpi_connector->encoder; -} - static const struct drm_connector_funcs vc4_dpi_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .detect = vc4_dpi_connector_detect, @@ -228,7 +220,6 @@ static const struct drm_connector_funcs vc4_dpi_connector_funcs = { static const struct drm_connector_helper_funcs vc4_dpi_connector_helper_funcs = { .get_modes = vc4_dpi_connector_get_modes, - .best_encoder = vc4_dpi_connector_best_encoder, }; static struct drm_connector *vc4_dpi_connector_init(struct drm_device *dev, diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index fd2644d..68df91c 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -208,14 +208,6 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) return ret; } -static struct drm_encoder * -vc4_hdmi_connector_best_encoder(struct drm_connector *connector) -{ - struct vc4_hdmi_connector *hdmi_connector - to_vc4_hdmi_connector(connector); - return hdmi_connector->encoder; -} - static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .detect = vc4_hdmi_connector_detect, @@ -228,7 +220,6 @@ static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = { .get_modes = vc4_hdmi_connector_get_modes, - .best_encoder = vc4_hdmi_connector_best_encoder, }; static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev, -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 15/20] drm: virtgpu: Rely on the default ->best_encoder() behavior
The virtgpu output exposes 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 at free-electrons.com> --- drivers/gpu/drm/virtio/virtgpu_display.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index d4305da..4d41dcb 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -341,15 +341,6 @@ static int virtio_gpu_conn_mode_valid(struct drm_connector *connector, return MODE_BAD; } -static struct drm_encoder* -virtio_gpu_best_encoder(struct drm_connector *connector) -{ - struct virtio_gpu_output *virtio_gpu_output - drm_connector_to_virtio_gpu_output(connector); - - return &virtio_gpu_output->enc; -} - static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = { .mode_set = virtio_gpu_enc_mode_set, .enable = virtio_gpu_enc_enable, @@ -359,7 +350,6 @@ static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = { static const struct drm_connector_helper_funcs virtio_gpu_conn_helper_funcs = { .get_modes = virtio_gpu_conn_get_modes, .mode_valid = virtio_gpu_conn_mode_valid, - .best_encoder = virtio_gpu_best_encoder, }; static enum drm_connector_status virtio_gpu_conn_detect( -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 16/20] drm: omap: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com> --- drivers/gpu/drm/omapdrm/omap_connector.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index ce2d67b..137fe69 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c @@ -32,7 +32,6 @@ struct omap_connector { struct drm_connector base; struct omap_dss_device *dssdev; - struct drm_encoder *encoder; bool hdmi_mode; }; @@ -256,13 +255,6 @@ static int omap_connector_mode_valid(struct drm_connector *connector, return ret; } -struct drm_encoder *omap_connector_attached_encoder( - struct drm_connector *connector) -{ - struct omap_connector *omap_connector = to_omap_connector(connector); - return omap_connector->encoder; -} - static const struct drm_connector_funcs omap_connector_funcs = { .dpms = drm_atomic_helper_connector_dpms, .reset = drm_atomic_helper_connector_reset, @@ -276,7 +268,6 @@ static const struct drm_connector_funcs omap_connector_funcs = { static const struct drm_connector_helper_funcs omap_connector_helper_funcs = { .get_modes = omap_connector_get_modes, .mode_valid = omap_connector_mode_valid, - .best_encoder = omap_connector_attached_encoder, }; /* initialize connector */ @@ -296,7 +287,6 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, goto fail; omap_connector->dssdev = dssdev; - omap_connector->encoder = encoder; connector = &omap_connector->base; -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 17/20] drm/bridge: anx78xx: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/bridge/analogix-anx78xx.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c index d087b05..f9f03bc 100644 --- a/drivers/gpu/drm/bridge/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c @@ -986,16 +986,8 @@ unlock: return num_modes; } -static struct drm_encoder *anx78xx_best_encoder(struct drm_connector *connector) -{ - struct anx78xx *anx78xx = connector_to_anx78xx(connector); - - return anx78xx->bridge.encoder; -} - static const struct drm_connector_helper_funcs anx78xx_connector_helper_funcs = { .get_modes = anx78xx_get_modes, - .best_encoder = anx78xx_best_encoder, }; static enum drm_connector_status anx78xx_detect(struct drm_connector *connector, -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 18/20] drm/bridge: ptn3460: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/bridge/nxp-ptn3460.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c index 7ecd59f..93f3dac 100644 --- a/drivers/gpu/drm/bridge/nxp-ptn3460.c +++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c @@ -235,16 +235,8 @@ out: return num_modes; } -static struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector) -{ - struct ptn3460_bridge *ptn_bridge = connector_to_ptn3460(connector); - - return ptn_bridge->bridge.encoder; -} - static const struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = { .get_modes = ptn3460_get_modes, - .best_encoder = ptn3460_best_encoder, }; static enum drm_connector_status ptn3460_detect(struct drm_connector *connector, -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 19/20] drm/bridge: ps8622: Rely on the default ->best_encoder() behavior
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 at free-electrons.com> --- drivers/gpu/drm/bridge/parade-ps8622.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c index be881e9..5cd8dd7 100644 --- a/drivers/gpu/drm/bridge/parade-ps8622.c +++ b/drivers/gpu/drm/bridge/parade-ps8622.c @@ -474,18 +474,8 @@ static int ps8622_get_modes(struct drm_connector *connector) return drm_panel_get_modes(ps8622->panel); } -static struct drm_encoder *ps8622_best_encoder(struct drm_connector *connector) -{ - struct ps8622_bridge *ps8622; - - ps8622 = connector_to_ps8622(connector); - - return ps8622->bridge.encoder; -} - static const struct drm_connector_helper_funcs ps8622_connector_helper_funcs = { .get_modes = ps8622_get_modes, - .best_encoder = ps8622_best_encoder, }; static enum drm_connector_status ps8622_detect(struct drm_connector *connector, -- 2.7.4
Boris Brezillon
2016-Jun-07 11:48 UTC
[PATCH v2 20/20] drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder()
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 at 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
Daniel Vetter
2016-Jun-07 14:39 UTC
[PATCH v2 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid
On Tue, Jun 07, 2016 at 01:47:56PM +0200, 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(). > > Update the vtables documentation accordingly. > > Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>Applied to drm-misc, thanks. I think I'll wait with the driver patches until next week or so. -Daniel> --- > drivers/gpu/drm/drm_atomic_helper.c | 4 +++- > drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++- > include/drm/drm_modeset_helper_vtables.h | 10 ++++++++-- > 3 files changed, 23 insertions(+), 4 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; > > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index d4619dc..4e7a53b 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -736,6 +736,11 @@ struct drm_connector_helper_funcs { > * inspect dynamic configuration state should instead use > * @atomic_best_encoder. > * > + * You can leave this function to NULL if the connector is only > + * attached to a single encoder and you are using the atomic helpers. > + * In this case, the core will call drm_atomic_helper_best_encoder() > + * for you. > + * > * RETURNS: > * > * Encoder that should be used for the given connector and connector > @@ -752,8 +757,9 @@ struct drm_connector_helper_funcs { > * need to select the best encoder depending upon the desired > * configuration and can't select it statically. > * > - * This function is used by drm_atomic_helper_check_modeset() and either > - * this or @best_encoder is required. > + * This function is used by drm_atomic_helper_check_modeset(). > + * If it is not implemented, the core will fallback to @best_encoder > + * (or drm_atomic_helper_best_encoder() if @best_encoder is NULL). > * > * NOTE: > * > -- > 2.7.4 >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Vincent ABRIOU
2016-Jun-08 09:35 UTC
[PATCH v2 11/20] drm: sti: Rely on the default ->best_encoder() behavior
Hi Boris, Thanks for the patch. Acked-by: Vincent Abriou <vincent.abriou at st.com> Vincent On 06/07/2016 01:48 PM, Boris Brezillon wrote:> 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 at 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 */ >
Archit Taneja
2016-Jun-08 10:09 UTC
[PATCH v2 08/20] drm: msm: Rely on the default ->best_encoder() behavior where appropriate
Hi, On 06/07/2016 05:18 PM, Boris Brezillon wrote:> For all outputs except DSI 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.Works fine with msm. Tested-by: Archit Taneja <architt at codeaurora.org> Thanks, Archit> > Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com> > --- > drivers/gpu/drm/msm/edp/edp_connector.c | 10 ---------- > drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 8 -------- > drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c | 9 --------- > 3 files changed, 27 deletions(-) > > diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c > index 72360cd..5960628 100644 > --- a/drivers/gpu/drm/msm/edp/edp_connector.c > +++ b/drivers/gpu/drm/msm/edp/edp_connector.c > @@ -91,15 +91,6 @@ static int edp_connector_mode_valid(struct drm_connector *connector, > return MODE_OK; > } > > -static struct drm_encoder * > -edp_connector_best_encoder(struct drm_connector *connector) > -{ > - struct edp_connector *edp_connector = to_edp_connector(connector); > - > - DBG(""); > - return edp_connector->edp->encoder; > -} > - > static const struct drm_connector_funcs edp_connector_funcs = { > .dpms = drm_atomic_helper_connector_dpms, > .detect = edp_connector_detect, > @@ -113,7 +104,6 @@ static const struct drm_connector_funcs edp_connector_funcs = { > static const struct drm_connector_helper_funcs edp_connector_helper_funcs = { > .get_modes = edp_connector_get_modes, > .mode_valid = edp_connector_mode_valid, > - .best_encoder = edp_connector_best_encoder, > }; > > /* initialize connector */ > diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c > index b15d726..a2515b4 100644 > --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c > +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c > @@ -406,13 +406,6 @@ static int msm_hdmi_connector_mode_valid(struct drm_connector *connector, > return 0; > } > > -static struct drm_encoder * > -msm_hdmi_connector_best_encoder(struct drm_connector *connector) > -{ > - struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); > - return hdmi_connector->hdmi->encoder; > -} > - > static const struct drm_connector_funcs hdmi_connector_funcs = { > .dpms = drm_atomic_helper_connector_dpms, > .detect = hdmi_connector_detect, > @@ -426,7 +419,6 @@ static const struct drm_connector_funcs hdmi_connector_funcs = { > static const struct drm_connector_helper_funcs msm_hdmi_connector_helper_funcs = { > .get_modes = msm_hdmi_connector_get_modes, > .mode_valid = msm_hdmi_connector_mode_valid, > - .best_encoder = msm_hdmi_connector_best_encoder, > }; > > /* initialize connector */ > diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c > index 2648cd7..353429b 100644 > --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c > +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c > @@ -90,14 +90,6 @@ static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector, > return MODE_OK; > } > > -static struct drm_encoder * > -mdp4_lvds_connector_best_encoder(struct drm_connector *connector) > -{ > - struct mdp4_lvds_connector *mdp4_lvds_connector > - to_mdp4_lvds_connector(connector); > - return mdp4_lvds_connector->encoder; > -} > - > static const struct drm_connector_funcs mdp4_lvds_connector_funcs = { > .dpms = drm_atomic_helper_connector_dpms, > .detect = mdp4_lvds_connector_detect, > @@ -111,7 +103,6 @@ static const struct drm_connector_funcs mdp4_lvds_connector_funcs = { > static const struct drm_connector_helper_funcs mdp4_lvds_connector_helper_funcs = { > .get_modes = mdp4_lvds_connector_get_modes, > .mode_valid = mdp4_lvds_connector_mode_valid, > - .best_encoder = mdp4_lvds_connector_best_encoder, > }; > > /* initialize connector */ >-- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Matthias Brugger
2016-Jun-08 11:17 UTC
[PATCH v2 07/20] drm: mediatek: Rely on the default ->best_encoder() behavior
On 07/06/16 13:48, Boris Brezillon wrote:> 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 at free-electrons.com>Reviewed-by: Matthias Brugger <matthias.bgg at gmail.com>> --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index 2d808e5..7343ffc 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -575,14 +575,6 @@ static int mtk_dsi_connector_get_modes(struct drm_connector *connector) > return drm_panel_get_modes(dsi->panel); > } > > -static struct drm_encoder *mtk_dsi_connector_best_encoder( > - struct drm_connector *connector) > -{ > - struct mtk_dsi *dsi = connector_to_dsi(connector); > - > - return &dsi->encoder; > -} > - > static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = { > .mode_fixup = mtk_dsi_encoder_mode_fixup, > .mode_set = mtk_dsi_encoder_mode_set, > @@ -603,7 +595,6 @@ static const struct drm_connector_funcs mtk_dsi_connector_funcs = { > static const struct drm_connector_helper_funcs > mtk_dsi_connector_helper_funcs = { > .get_modes = mtk_dsi_connector_get_modes, > - .best_encoder = mtk_dsi_connector_best_encoder, > }; > > static int mtk_drm_attach_bridge(struct drm_bridge *bridge, >
Daniel Vetter
2016-Jun-10 15:24 UTC
[PATCH v2 06/20] drm: i915: Rely on the default ->best_encoder() behavior where appropriate
On Tue, Jun 07, 2016 at 01:48:01PM +0200, Boris Brezillon wrote:> 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 at free-electrons.com>You can also drop the best_encoder from intel_dp_mst, we only need the atomic_best_encoder. The best_encoder there was needed to help out the fbdev emulation. Care to respin? -Daniel> --- > 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 >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Daniel Vetter
2016-Jun-10 15:25 UTC
[PATCH v2 00/20] drm/atomic: Provide default ->best_encoder() behavior
On Tue, Jun 07, 2016 at 01:47:55PM +0200, Boris Brezillon wrote:> Hello, > > This patch series aims at replacing all dummy ->best_encoder() > implementations where we have a 1:1 relationship between encoders > and connectors. > The core already provides the drm_atomic_helper_best_encoder() > function which is taking the first encoder attached to the > connector (after making sure only one encoder was attached to the > connector), but it's not automatically used, and drivers wanting > to rely on this default behavior have to explicitly assign their > ->best_encoder() hook to drm_atomic_helper_best_encoder(). > > The first patch fixes remaining places where > drm_atomic_helper_best_encoder() should be called when ->best_encoder() > is NULL, so that drivers using the atomic helpers can get rid of the > explicit ->best_encoder assignment if they need to rely on the default > drm_atomic_helper_best_encoder() implementation. > > The following patches are killing all open coded ->best_encoder() > implementations that could be replaced by > drm_atomic_helper_best_encoder(). > > All modifications have been compile tested except for the changed on > the intel driver. > I've also tested on an atmel board, but I recommend waiting for DRM > driver maintainers feedback before applying the associated changes. > > Note that once patch 1 is applied, the other patches can be applied > independently.One comment on the i915 patch, all others should now be in drm-misc. Thanks a lot for doing this. -Daniel> > Best Regards, > > Boris > > Changes since v1: > - remove useless ->encoder backpointers in some implementations > - documented the default behavior in the vtable doc > - added R-b/A-b tags > > Boris Brezillon (20): > drm/atomic: Fix remaining places where !funcs->best_encoder is valid > drm: arc: Rely on the default ->best_encoder() behavior > drm: atmel-hlcdc: Rely on the default ->best_encoder() behavior > drm: exynos: Rely on the default ->best_encoder() behavior > drm: fsl-dcu: Rely on the default ->best_encoder() behavior > drm: i915: Rely on the default ->best_encoder() behavior where > appropriate > drm: mediatek: Rely on the default ->best_encoder() behavior > drm: msm: Rely on the default ->best_encoder() behavior where > appropriate > drm: rcar-du: Rely on the default ->best_encoder() behavior > drm: rockchip: Rely on the default ->best_encoder() behavior > drm: sti: Rely on the default ->best_encoder() behavior > drm: sun4i: Rely on the default ->best_encoder() behavior > drm: tegra: Rely on the default ->best_encoder() behavior > drm: vc4: Rely on the default ->best_encoder() behavior > drm: virtgpu: Rely on the default ->best_encoder() behavior > drm: omap: Rely on the default ->best_encoder() behavior > drm/bridge: anx78xx: Rely on the default ->best_encoder() behavior > drm/bridge: ptn3460: Rely on the default ->best_encoder() behavior > drm/bridge: ps8622: Rely on the default ->best_encoder() behavior > drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder() > > drivers/gpu/drm/arc/arcpgu_hdmi.c | 18 ------------------ > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ------------ > drivers/gpu/drm/bridge/analogix-anx78xx.c | 8 -------- > drivers/gpu/drm/bridge/dw-hdmi.c | 11 +---------- > drivers/gpu/drm/bridge/nxp-ptn3460.c | 8 -------- > drivers/gpu/drm/bridge/parade-ps8622.c | 10 ---------- > drivers/gpu/drm/drm_atomic_helper.c | 4 +++- > drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++++++- > drivers/gpu/drm/exynos/exynos_drm_dpi.c | 9 --------- > drivers/gpu/drm/exynos/exynos_drm_dsi.c | 9 --------- > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 -------- > drivers/gpu/drm/exynos/exynos_hdmi.c | 8 -------- > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 9 --------- > 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 - > drivers/gpu/drm/mediatek/mtk_dsi.c | 9 --------- > drivers/gpu/drm/msm/edp/edp_connector.c | 10 ---------- > drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 8 -------- > drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c | 9 --------- > drivers/gpu/drm/omapdrm/omap_connector.c | 10 ---------- > drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 12 ------------ > drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 3 --- > drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 1 - > drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 1 - > drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 --- > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 9 --------- > drivers/gpu/drm/rockchip/inno_hdmi.c | 9 --------- > drivers/gpu/drm/sti/sti_dvo.c | 10 ---------- > drivers/gpu/drm/sti/sti_hda.c | 10 ---------- > drivers/gpu/drm/sti/sti_hdmi.c | 10 ---------- > drivers/gpu/drm/sun4i/sun4i_rgb.c | 10 ---------- > drivers/gpu/drm/sun4i/sun4i_tv.c | 9 --------- > drivers/gpu/drm/tegra/drm.h | 2 -- > drivers/gpu/drm/tegra/dsi.c | 1 - > drivers/gpu/drm/tegra/hdmi.c | 1 - > drivers/gpu/drm/tegra/output.c | 8 -------- > drivers/gpu/drm/tegra/rgb.c | 1 - > drivers/gpu/drm/tegra/sor.c | 1 - > drivers/gpu/drm/vc4/vc4_dpi.c | 9 --------- > drivers/gpu/drm/vc4/vc4_hdmi.c | 9 --------- > drivers/gpu/drm/virtio/virtgpu_display.c | 10 ---------- > include/drm/drm_modeset_helper_vtables.h | 10 ++++++++-- > 50 files changed, 24 insertions(+), 305 deletions(-) > > -- > 2.7.4 >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Possibly Parallel Threads
- [PATCH v2 00/20] drm/atomic: Provide default ->best_encoder() behavior
- [PATCH 00/20] drm/atomic: Provide default ->best_encoder() behavior
- [PATCH 00/20] drm/atomic: Provide default ->best_encoder() behavior
- [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior
- [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior