From patchwork Thu Jul 26 18:49:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1245381 Return-Path: X-Original-To: patchwork-intel-gfx@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 175A33FC33 for ; Thu, 26 Jul 2012 20:51:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2814A0EEB for ; Thu, 26 Jul 2012 13:51:57 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 3B8F29ED88 for ; Thu, 26 Jul 2012 12:57:38 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id hm11so1801934wib.12 for ; Thu, 26 Jul 2012 12:57:38 -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=5duCEaqFoHL41JnwaOOeZABzSmhQZLjhs+85P5ptVXg=; b=ItVZ2wBBjaKrtgxst90sBBNawVwrdSKtw4X3OoqDxJdoYEtlnfJOyWz+7V1OXtORXi cn836Rl2T3atZSJexkswQQxs+yBc78PBk8Qv5pcBiEzMeUIgCfCLHAJ9TV4hSk27C4BO R3Y0ZbSYZLLQOc6ji3REIw/8otOfu/wHL/JZk= 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=5duCEaqFoHL41JnwaOOeZABzSmhQZLjhs+85P5ptVXg=; b=S0sOAlFL9INHSlzw6VRE9H/mFxVR4GRcPuj2nT+sWiudXi2xAurDRq/wlJdlgc+WGG hr6OnLSn8PJmAr5zeGo1dRGKeRt6Uomg+Pa1lR1oV10sbfC8meNqJ4lgYiKL8+WjEquE u6XBQ0zljMFzKIc3S9GvymwSoH3BVHBUn5QVnlSwW6jLhDYghnYxSTQ0RifRUB4F9Zjy cTgucsNg4iFL1YxtsCiO3jHFkH2ZHDGXNyMl7hKUJXdPosbWILvBAbzetwrsCEJfDw6g 3K1yBpMtuldnLcV3wusv0AR1waPFlGsQ1mb7vGRHrr2jscSl63ewP6RXznHnVseieQoM 9+Kw== Received: by 10.216.24.85 with SMTP id w63mr15734776wew.145.1343332657869; Thu, 26 Jul 2012 12:57:37 -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 fr4sm391403wib.8.2012.07.26.12.57.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:57:37 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 26 Jul 2012 20:49:31 +0200 Message-Id: <1343328581-2324-67-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> References: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkVHKjsq9GUNbxe0AfX0OnLsolsKjXktk3CaupTwtgCRFsSWzyBYqLkJ9OsqxROC6l77Ygh Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 66/76] drm/i915: add tons of modeset state checks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org ... let's see how whether this catches anything earlier and I can track down a few bugs. v2: Add more checks and also add DRM_DEBUG_KMS output so that it's clear which connector/encoder/crtc is being checked atm. Which proved rather useful for debugging ... v3: Add a WARN in the common encoder dpms function, now that also modeset changes properly update the dpms state ... Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 75 +++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bd00dde..09ee248 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3636,7 +3636,7 @@ void intel_connector_dpms(struct drm_connector *connector, int mode) if (encoder->base.crtc) intel_encoder_dpms(encoder, mode); else - encoder->connectors_active = false; + WARN_ON(encoder->connectors_active != false); intel_connector_check_state(to_intel_connector(connector)); } @@ -6750,6 +6750,75 @@ static bool intel_crtc_in_use(struct drm_crtc *crtc) base.head) \ if (mask & (1 <<(intel_crtc)->pipe)) \ +static void +intel_modeset_check_state(struct drm_device *dev) +{ + struct intel_crtc *crtc; + struct intel_encoder *encoder; + struct intel_connector *connector; + + list_for_each_entry(connector, &dev->mode_config.connector_list, + base.head) { + /* This also checks the encoder/connector hw state with the + * ->get_hw_state callbacks. */ + intel_connector_check_state(connector); + + WARN_ON(&connector->new_encoder->base != connector->base.encoder); + } + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, + base.head) { + bool enabled = false; + bool active = false; + enum pipe pipe; + + DRM_DEBUG_KMS("[ENCODER:%d:%s]\n", + encoder->base.base.id, + drm_get_encoder_name(&encoder->base)); + + WARN_ON(&encoder->new_crtc->base != encoder->base.crtc); + WARN_ON(encoder->connectors_active && !encoder->base.crtc); + + list_for_each_entry(connector, &dev->mode_config.connector_list, + base.head) { + if (connector->base.encoder != &encoder->base) + continue; + enabled = true; + if (connector->base.dpms == DRM_MODE_DPMS_ON) + active = true; + } + WARN_ON(!!encoder->base.crtc != enabled); + /* dpms on only implies active. */ + WARN_ON(active && !encoder->base.crtc); + WARN_ON(encoder->get_hw_state(encoder, &pipe) + && !encoder->base.crtc); + } + + list_for_each_entry(crtc, &dev->mode_config.crtc_list, + base.head) { + bool enabled = false; + bool active = false; + + DRM_DEBUG_KMS("[CRTC:%d]\n", + crtc->base.base.id); + + WARN_ON(crtc->active && !crtc->base.enabled); + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, + base.head) { + if (encoder->base.crtc != &crtc->base) + continue; + enabled = true; + if (encoder->connectors_active) + active = true; + } + WARN_ON(active != crtc->active); + WARN_ON(enabled != crtc->base.enabled); + + assert_pipe(dev->dev_private, crtc->pipe, crtc->active); + } +} + bool intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, int x, int y, struct drm_framebuffer *fb) @@ -6868,6 +6937,8 @@ done: crtc->mode = saved_mode; } + intel_modeset_check_state(dev); + return ret; } @@ -8076,6 +8147,8 @@ void intel_modeset_setup_hw_state(struct drm_device *dev) } intel_modeset_update_staged_output_state(dev); + + intel_modeset_check_state(dev); } void intel_modeset_gem_init(struct drm_device *dev)