From patchwork Tue Oct 23 18:23:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1632241 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E8C57DF283 for ; Tue, 23 Oct 2012 19:36:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D96DF9F760 for ; Tue, 23 Oct 2012 12:36:16 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id B2B849F729 for ; Tue, 23 Oct 2012 12:32:01 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id hj13so3054541wib.12 for ; Tue, 23 Oct 2012 12:32:01 -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=j6nw3U+es42uvnKO9LT4i90SrSh8q4G9LhSn6krDk1A=; b=RPZKfPkbRT+sgEOZNimo2NCH94CB+V8D2zUV5S1lhPwV5dEOs8n8YLf89ykytePO6R HHNjmqTeN1m5jcPnFKqh0beW/f7K1jjqVfeWe5x/cXbrC5jFdCkRvoRsMMQjdWVzf4jL 6YsbKEX1rJoZQ93zvG7SupStw/Z8kypXBovDg= 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=j6nw3U+es42uvnKO9LT4i90SrSh8q4G9LhSn6krDk1A=; b=CgxI+SuHHzdUYobhbAYikfZeIz8IlxT1f3KWBh8VLoqDSzyiCxrMmpRWpOlCdjzOwb mJ4K4VCNY7+Klj3dRj/VFBhe57+y28XHjm8O+UvIGl+7FE1Ak4w4L1lidNLCSjI85n66 4MFmTJNRQ0cHtNI6EywvZvaFD3BF69sZ02Ui5xPyDODw126h9f4cZpmDg/b8Zl41xijI 1w0GamQNdEdIXaqNW/6ooGzWUMN0d79r5IHtV2DKl6Utqpl6P5PCRxMfVCYjeK8y1yBf qRW21kxT6QQSLlP8qL8kLoYdkYXV1cFxDBeFSS6z2ovSRGY5IFcBFGAFnx6JhpoUm99M KluA== Received: by 10.180.80.100 with SMTP id q4mr245413wix.20.1351020721124; Tue, 23 Oct 2012 12:32:01 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id di7sm312800wib.11.2012.10.23.12.32.00 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Oct 2012 12:32:00 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 5/7] drm: don't start the poll engine in probe_single_connector Date: Tue, 23 Oct 2012 20:23:36 +0200 Message-Id: <1351016618-2752-6-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351016618-2752-1-git-send-email-daniel.vetter@ffwll.ch> References: <1351016618-2752-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkNJaCuML9MUcknOgV6RwnE3wPFboRNuRrvVvC5tFudwlnqkZ+0vATYFLM/MsUgQpU8jifV Cc: Daniel Vetter 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 Actually there's a reason this stuff is there, and it's called commit e58f637bb96d5a0ae0919b9998b891d1ba7e47c9 Author: Chris Wilson Date: Fri Aug 20 09:13:36 2010 +0100 drm/kms: Add a module parameter to disable polling The idea has been that users can enable/disable polling at runtime. So the quick hack has been to just re-enable the output polling if xrandr asks for the latest state of the connectors. The problem with that hack is that when we force connectors to another state than what would be detected, we nicely ping-pong: - Userspace calls probe, gets the forced state, but polling starts again. - Polling notices that the state is actually different, wakes up userspace. - Repeat. As that commit already explains, the right fix would be to make the locking more fine-grained, so that hotplug detection on one output does not interfere with cursor updates on another crtc. But that is way too much work. So let's just safe this gross hack by caching the last-seen state of drm_kms_helper_poll for that driver, and only fire up the poll engine again if it changed from off to on. v2: Fixup the edge detection of drm_kms_helper_poll. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49907 Tested-by: Tvrtko Ursulin Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc_helper.c | 7 ++++++- include/drm/drm_crtc.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 654080b..bb94b6d 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -109,9 +109,14 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, connector->funcs->force(connector); } else { connector->status = connector->funcs->detect(connector, true); - drm_kms_helper_poll_enable(dev); } + /* Re-enable polling in case the global poll config changed. */ + if (drm_kms_helper_poll != dev->mode_config.poll_running) + drm_kms_helper_poll_enable(dev); + + dev->mode_config.poll_running = drm_kms_helper_poll; + if (connector->status == connector_status_disconnected) { DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", connector->base.id, drm_get_connector_name(connector)); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 3fa18b7..89f8f7f 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -792,6 +792,7 @@ struct drm_mode_config { /* output poll support */ bool poll_enabled; + bool poll_running; struct delayed_work output_poll_work; /* pointers to standard properties */