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: 9491173 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 153B260453 for ; Thu, 29 Dec 2016 12:18:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECD231FF60 for ; Thu, 29 Dec 2016 12:18:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFAB224DA2; Thu, 29 Dec 2016 12:18:02 +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=ham 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 0D1FF1FF60 for ; Thu, 29 Dec 2016 12:18:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D6536E0C7; Thu, 29 Dec 2016 12:17:57 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 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 Subject: [Intel-gfx] [PATCH] drm: clean cached display info X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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; }