From patchwork Tue Jul 3 21:48:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 1153221 Return-Path: X-Original-To: patchwork-intel-gfx@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 1A3E4DF235 for ; Tue, 3 Jul 2012 21:48:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E311E9E85D for ; Tue, 3 Jul 2012 14:48:43 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-gh0-f177.google.com (mail-gh0-f177.google.com [209.85.160.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D34A9E85D for ; Tue, 3 Jul 2012 14:48:30 -0700 (PDT) Received: by ghbf11 with SMTP id f11so6290381ghb.36 for ; Tue, 03 Jul 2012 14:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WRpkYs4NnRCdpsCUxJUvgQdxxXBEWrt7FhcQDcgsxB0=; b=jhUU4X+DErZwU04N3IzYNuo2foa9RVWuvabGY9+hZxH8VApA7JTuBv4d2oxVr8M5Z4 oWRJ2q0TFGAMTKlFI218TRqNgsWFxKHPEBRuBvZazu0hmbKA8j/PrehYHJr/4kcz6JjL mqsA4/L459Z8BL0bFe6W9A3zGwCVMKuyrkzr98nJysD7AXTR9TzaeJn+p4FKsh5LrIkf fkzbhgghvJ9Uehv383R6fpxMlRlPwoh3IrNlUJxL7kW2DFSSFWXUZCafHk+Q193Fkfsu 5fuzCY67P2mOFhHXxN7JnVWRbLyp/Rk/RJnst2bVzd6pWcBRnbAvvueuj5fOH3cU/A3t 7ivg== Received: by 10.101.143.14 with SMTP id v14mr6590501ann.55.1341352109729; Tue, 03 Jul 2012 14:48:29 -0700 (PDT) Received: from vicky.domain.invalid (189.26.42.14.dynamic.adsl.gvt.net.br. [189.26.42.14]) by mx.google.com with ESMTPS id z3sm14070304anj.17.2012.07.03.14.48.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 14:48:29 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 3 Jul 2012 18:48:16 -0300 Message-Id: <1341352096-19712-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341341853-4092-1-git-send-email-przanoni@gmail.com> References: <1341341853-4092-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 1/3] drm/i915: add PCH_NONE to enum intel_pch 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 From: Paulo Zanoni And rely on the fact that it's 0 to assume that machines without a PCH will have PCH_NONE as dev_priv->pch_type. Just today I finally realized that HAS_PCH_IBX is true for machines without a PCH. IMHO this is totally counter-intuitive and I don't think it's a good idea to assume that we're going to check for HAS_PCH_IBX only after we check for HAS_PCH_SPLIT. I believe that in the future we'll have more PCH types and checks like: if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) will become more and more common. There's a good chance that we may break non-PCH machines by adding these checks in code that runs on all machines. I also believe that the HAS_PCH_SPLIT check will become less common as we add more and more different PCH types. We'll probably start replacing checks like: if (HAS_PCH_SPLIT(dev)) foo(); else bar(); with: if (HAS_PCH_NEW(dev)) baz(); else if (HAS_PCH_OLD(dev) || HAS_PCH_IBX(dev)) foo(); else bar(); and this may break gen 2/3/4. As far as we have investigated, this patch will affect the behavior of intel_hdmi_dpms and intel_dp_link_down on gen 4. In both functions the code inside the HAS_PCH_IBX check is for IBX-specific workarounds, so we should be safe. If we start bisecting gen 2/3/4 bugs to this commit we should consider replacing the HAS_PCH_IBX checks with something else. V2: Improve commit message, list possible side effects and solution. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_drv.h | 1 + 1 file changed, 1 insertion(+) Another alternative would have been to change HAS_PCH_IBX to also check for HAS_PCH_SPLIT, but I'm not exactly in favor of adding more conditionals... diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b7a1eaa..b12e79a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -333,6 +333,7 @@ enum no_fbc_reason { }; enum intel_pch { + PCH_NONE = 0, /* No PCH present */ PCH_IBX, /* Ibexpeak PCH */ PCH_CPT, /* Cougarpoint PCH */ PCH_LPT, /* Lynxpoint PCH */