Hi Am 07.06.22 um 12:03 schrieb Jani Nikula:
On Tue, 31 May 2022, Thomas Zimmermann <tzimmermann@xxxxxxx> wrote:Enable output polling for all connectors. VGA always uses EDID for this. As there's currently no interrupt handling for the ast devices, we have to use that trick for the various DP and DVI ports as well.In general, please don't add new helper functions under "drm/ast" subject prefix. These will go under the radar. I only stumbled on this by accident. Please don't add new helper functions around get_modes and EDID reading. I've been putting a lot of effort into changing how EDID will be handled going forward, and this will just make it harder. See e.g. [1], though there are pending review comments. Please don't use connector->edid_blob_ptr for basically anything in the drivers, or for logic regarding detection. It's way too overloaded already, and difficult to untangle.
Thanks for the that info. I'll merge patch 1, which is unrelated and later recreate my patchset on top of your changes.
Best regards Thomas
BR, Jani. [1] https://patchwork.freedesktop.org/series/104309/Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/ast/ast_mode.c | 14 ++++++++---- drivers/gpu/drm/drm_probe_helper.c | 35 ++++++++++++++++++++++++++++++ include/drm/drm_probe_helper.h | 3 +++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 4ff8ec1c8931..bbc566c4c768 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1319,6 +1319,7 @@ static int ast_vga_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = {.get_modes = ast_vga_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_vga_connector_funcs = {@@ -1354,7 +1355,7 @@ static int ast_vga_connector_init(struct drm_device *dev, connector->interlace_allowed = 0; connector->doublescan_allowed = 0;- connector->polled = DRM_CONNECTOR_POLL_CONNECT;+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;return 0;} @@ -1390,6 +1391,7 @@ static int ast_vga_output_init(struct ast_private *ast)static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs = {.get_modes = ast_vga_connector_helper_get_modes, // same as VGA connector + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_sil164_connector_funcs = {@@ -1425,7 +1427,7 @@ static int ast_sil164_connector_init(struct drm_device *dev, connector->interlace_allowed = 0; connector->doublescan_allowed = 0;- connector->polled = DRM_CONNECTOR_POLL_CONNECT;+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;return 0;} @@ -1488,6 +1490,7 @@ static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = {.get_modes = ast_dp501_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_dp501_connector_funcs = {@@ -1512,7 +1515,7 @@ static int ast_dp501_connector_init(struct drm_device *dev, struct drm_connector connector->interlace_allowed = 0; connector->doublescan_allowed = 0;- connector->polled = DRM_CONNECTOR_POLL_CONNECT;+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;return 0;} @@ -1575,6 +1578,7 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = {.get_modes = ast_astdp_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_astdp_connector_funcs = {@@ -1599,7 +1603,7 @@ static int ast_astdp_connector_init(struct drm_device *dev, struct drm_connector connector->interlace_allowed = 0; connector->doublescan_allowed = 0;- connector->polled = DRM_CONNECTOR_POLL_CONNECT;+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;return 0;} @@ -1709,5 +1713,7 @@ int ast_mode_config_init(struct ast_private *ast)drm_mode_config_reset(dev); + drm_kms_helper_poll_init(dev);+ return 0; } diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 425f56280d51..4440a7b6b240 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -1031,3 +1031,38 @@ int drm_connector_helper_get_modes_from_ddc(struct drm_connector *connector) return count; } EXPORT_SYMBOL(drm_connector_helper_get_modes_from_ddc); + +/** + * drm_connector_helper_detect_ctx_from_edid - + * Updates the connector's status by reading EDID data + * @connector: The connector. + * @ctx: The lock-acquisition context. + * @force: True if the operation was requested by userspace, false otherwise. + * + * Returns: + * The connector's status as enum drm_connector_status. + * + * Updates the connector's EDID property by reading the display modes + * and returns the connector's status. If the EDID property is set, the + * connector is assumed to be connected; and disconnected otherwise. + * If the get_modes helper is missing, the default status is 'unknown'. + * + * See struct drm_connector_helper_funcs.detect_ctx. + */ +int drm_connector_helper_detect_ctx_from_edid(struct drm_connector *connector, + struct drm_modeset_acquire_ctx *ctx, + bool force) +{ + const struct drm_connector_helper_funcs *helper_funcs = connector->helper_private; + + if (!helper_funcs || !helper_funcs->get_modes) + return connector_status_unknown; + + helper_funcs->get_modes(connector); + + if (!connector->edid_blob_ptr) + return connector_status_disconnected; + + return connector_status_connected; +} +EXPORT_SYMBOL(drm_connector_helper_detect_ctx_from_edid); diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h index c80cab7a53b7..7408cf010794 100644 --- a/include/drm/drm_probe_helper.h +++ b/include/drm/drm_probe_helper.h @@ -27,5 +27,8 @@ void drm_kms_helper_poll_enable(struct drm_device *dev); bool drm_kms_helper_is_poll_worker(void);int drm_connector_helper_get_modes_from_ddc(struct drm_connector *connector);+int drm_connector_helper_detect_ctx_from_edid(struct drm_connector *connector, + struct drm_modeset_acquire_ctx *ctx, + bool force);#endif
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature