From patchwork Wed Jun 5 22:17:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2676341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 367E33FD4F for ; Wed, 5 Jun 2013 22:19:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 770B8E6540 for ; Wed, 5 Jun 2013 15:19:45 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 8880FE5EC5 for ; Wed, 5 Jun 2013 15:17:41 -0700 (PDT) Received: by mail-ee0-f54.google.com with SMTP id t10so502511eei.13 for ; Wed, 05 Jun 2013 15:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=tBr3Nq7qz7VFysvwPd2iOLvzCdAR3Nxn7q6pDVRX//0=; b=ifqY2YjO1/Jey1+kIPQuRLdDGfAnxsHyAUBmFlbF/nwftFcH8dYlDO4ts/cP1Co34o IkCZl/pFkT411P1w3CPtcP8iKnx9wloTJIz0c7kLqAJURwrI6O3w4wqTcV7LTkAiTnoR PSIb8X7DinaHADwtxjqqMk14du89IUVIBdyzA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tBr3Nq7qz7VFysvwPd2iOLvzCdAR3Nxn7q6pDVRX//0=; b=kMSComOxUSMD5VYGMyB5/XKPX9AR2hPslOdpf4E96uXhZb87skjfkGjQF4VJUm73bC gpZcbsyaNe1e2jgaTUoiKP8Wka2iAUUejOWYsh5d8aVwuHQY9eRjY8SZof9w+c4r6fTk 3L5W+Xg7PxZnNN39A8K9SsXC8Ir9GkWHBf7Tnr3zJ5nql6Zc1AuXGYzErwNmMea8Fn3m tUsuFUppW6HzhbfOLAys9FsdM4E9H5CJ7GsdT0bLHEzmJ7Mz7eYKovO5i2ddtfdsDMJq 15MYXtBfIUG2dqNwNKpWHxD8yKWkqvyCDL9GWkZr7jv/lkjICDtE8LO+TB4Y10yHOr1g p+1g== X-Received: by 10.15.56.198 with SMTP id y46mr31046087eew.58.1370470660399; Wed, 05 Jun 2013 15:17:40 -0700 (PDT) Received: from bremse.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id y44sm19160242eel.10.2013.06.05.15.17.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Jun 2013 15:17:39 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 2/2] drm/crtc-helper: clamp unknown connector status in the poll work Date: Thu, 6 Jun 2013 00:17:26 +0200 Message-Id: <1370470646-20006-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1370470646-20006-1-git-send-email-daniel.vetter@ffwll.ch> References: <1370470646-20006-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmwVK3MSTIxdG/HUp1qbFRRK5Kei6OHD+TMMCfiDlNBqBMnXpPtgu2aHXWJO6Mt2VMJqSA7 Cc: Alex Deucher , Daniel Vetter , Intel Graphics Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org On some chipset we try to avoid possibly invasive output detection methods (like load detect which can cause flickering elsewhere) in the output poll work. Drivers could hence return unknown when a previous full ->detect call returned a different state. This change will generate a hotplug event, forcing userspace to do a full scan. This in turn updates the connector->status field so that we will _again_ get a state change when the hotplug work re-runs in 10 seconds. To avoid this ping-pong loop detect this situation and clamp the connector state to the old value. Patch is inspired by a patch from Knut Peterson. Knut's patch completely ignored connector state changes if either the old or new status was unknown, which seemed to be a bit too agressive to me. References: http://lists.freedesktop.org/archives/dri-devel/2012-August/025975.html Cc: Knut Petersen Cc: Alex Deucher Signed-off-by: Daniel Vetter Acked-by: Alex Deucher --- drivers/gpu/drm/drm_crtc_helper.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 1c0c0bc..9985a17 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -1040,6 +1040,24 @@ static void output_poll_execute(struct work_struct *work) if (old_status != connector->status) { const char *old, *new; + /* + * The poll work sets force=false when calling detect so + * that drivers can avoid to do disruptive tests (e.g. + * when load detect cycles could cause flickering on + * other, running displays). This bears the risk that we + * flip-flop between unknown here in the poll work and + * the real state when userspace forces a full detect + * call after receiving a hotplug event due to this + * change. + * + * Hence clamp an unknown detect status to the old + * value. + */ + if (connector->status == connector_status_unknown) { + connector->status = old_status; + continue; + } + old = drm_get_connector_status_name(old_status); new = drm_get_connector_status_name(connector->status);