From patchwork Sun Aug 19 19:12:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1344941 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 EAAAA3FC33 for ; Sun, 19 Aug 2012 20:35:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5858A1024 for ; Sun, 19 Aug 2012 13:35:24 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 580D6A1038 for ; Sun, 19 Aug 2012 13:20:42 -0700 (PDT) Received: by mail-we0-f177.google.com with SMTP id r3so3851112wey.36 for ; Sun, 19 Aug 2012 13:20:42 -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=lltzHHiWFq5OlP8TPr8kQAtgp3Zp2HQVUgKlqTtUT3g=; b=hA+CGHysietXv86jAjbrAwx+UzGJpzefV7Ku3Ev9Ro9IZN0pWylmAwINjnLL0ixMx5 5/la3SY8PKLsp9sG0N8UWkUisswIA/Cs3QSIkibBDtcxaZAfEs7Wt5c0MoRDWgph9AwQ F6MklnwpGuJjfXyLfLrgCJw9X9kPy3stHoVKk= 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=lltzHHiWFq5OlP8TPr8kQAtgp3Zp2HQVUgKlqTtUT3g=; b=Fl1mA9yQcvD2vuIHxwhb15MKao7aVSTYCnCkSy8KhxRi19waXMg2bTJ09ALlVnNVfU FRc+6cXKrQBfpRQ73O79Er5a1iDxp5BVoS7Bzm+4CXzci0UYqY11rom2vx0jLnR5Tvk5 D9onsPsRvoBUrhvWmINaa2Lhb+Sml2ZlpIB7KbIm/p/LEwS7sxTlUB/ihJ6MWAwt8tOK iUYzjM0/n7V9c5efNHCzeHQxZ2gzmWvHfPPOF6FFqnJ2wSxBIv+CCwY5HHrhexAkbYXp YEprD4o9HdK/fqn8BrREr+0+ILyHHC2WlQOFYSBAn+zZbANdHYZ/66mBm6p7pgKnU9se tHog== Received: by 10.180.98.138 with SMTP id ei10mr22803318wib.1.1345407641980; Sun, 19 Aug 2012 13:20:41 -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 fu8sm24194367wib.5.2012.08.19.13.20.40 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Aug 2012 13:20:41 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 19 Aug 2012 21:12:38 +0200 Message-Id: <1345403595-9678-22-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> References: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmB0SzQPH7N97tXYmTX+juxoAS7gvAZZnUWTag539+1vR1hCMH376oQ9hQm6mc20L6/8g9X Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 21/58] drm/i915: WARN when trying to enabled an unused crtc 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 This is the first tiny step towards cross-checking the entire modeset state machine with WARNs. A crtc can only be enabled when it's actually in use, i.e. crtc->active imlies crtc->enabled. Unfortunately we can't (yet) check this when disabling the crtc, because the crtc helpers are a bit slopy with updating state and unconditionally update crtc->enabled before changing the hw state. Fixing that requires quite some more work. Signed-Off-by: Daniel Vetter Reviewed-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 4 ++++ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ca17010..5ab8694 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3215,6 +3215,8 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) u32 temp; bool is_pch_port; + WARN_ON(!crtc->enabled); + /* XXX: For compatability with the crtc helper code, call the encoder's * enable function unconditionally for now. */ if (intel_crtc->active) @@ -3391,6 +3393,8 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc) int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; + WARN_ON(!crtc->enabled); + /* XXX: For compatability with the crtc helper code, call the encoder's * enable function unconditionally for now. */ if (intel_crtc->active) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 673e8d4..36991de 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -158,7 +158,15 @@ struct intel_crtc { enum plane plane; u8 lut_r[256], lut_g[256], lut_b[256]; int dpms_mode; - bool active; /* is the crtc on? independent of the dpms mode */ + /* + * Whether the crtc and the connected output pipeline is active. Implies + * that crtc->enabled is set, i.e. the current mode configuration has + * some outputs connected to this crtc. + * + * Atm crtc->enabled is unconditionally updated _before_ the hw state is + * changed, hence we can only check this when enabling the crtc. + */ + bool active; bool primary_disabled; /* is the crtc obscured by a plane? */ bool lowfreq_avail; struct intel_overlay *overlay;