From patchwork Thu Dec 29 12:28:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 9491175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C47C60453 for ; Thu, 29 Dec 2016 12:18:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C1DD1FF60 for ; Thu, 29 Dec 2016 12:18:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FFB824DA2; Thu, 29 Dec 2016 12:18:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A0B21FF60 for ; Thu, 29 Dec 2016 12:18:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 10E746E0BF; Thu, 29 Dec 2016 12:17:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id DDB4A6E0BF; Thu, 29 Dec 2016 12:17:54 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 29 Dec 2016 04:17:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,426,1477983600"; d="scan'208"; a="1087811764" Received: from shashanks-desktop.iind.intel.com ([10.223.26.24]) by fmsmga001.fm.intel.com with ESMTP; 29 Dec 2016 04:17:47 -0800 From: Shashank Sharma To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH] drm: clean cached display info Date: Thu, 29 Dec 2016 17:58:50 +0530 Message-Id: <1483014530-27393-1-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 1.9.1 Cc: Jose Abreu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a small helper function, which clears the cached information about a hot-pluggable display, from connector. On event This will run on event of a hot-unplug, keeping the connector's display info up-to-date, avoiding any errors due to invalid cached data. Forking this patch out from the 3 patch series: https://patchwork.freedesktop.org/patch/128961/ (still under review) and sending as individual patch. Cc: Jose Abreu Cc: Daniel Vetter Suggested-by: Jose Abreu Signed-off-by: Shashank Sharma Reviewed-by: Jose Abreu Reviewed-by: Jose Abreu --- drivers/gpu/drm/drm_probe_helper.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 7cff91e..65a6a1f 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -164,6 +164,18 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev) } /** + * drm_helper_clear_display_info - clean cached display information for + * hot pluggable displays, on event of hot-unplug + * @connector: connector under event + */ +void drm_helper_clear_display_info(struct drm_connector *connector) +{ + struct drm_display_info *info = &connector->display_info; + + memset(info, 0, sizeof(*info)); +} + +/** * drm_helper_probe_single_connector_modes - get complete set of display modes * @connector: connector to probe * @maxX: max width for modes @@ -288,6 +300,16 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", connector->base.id, connector->name); drm_mode_connector_update_edid_property(connector, NULL); + + /* + * Connector status change to disconnected, time to clean + * cached display information. + * Any driver which doesn't use this probe_helper function + * should implement update of EDID property and display_info + * on its own. + */ + drm_helper_clear_display_info(connector); + verbose_prune = false; goto prune; }