From patchwork Mon Nov 7 11:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9414733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 816CF6022E for ; Mon, 7 Nov 2016 11:01:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C7727B81 for ; Mon, 7 Nov 2016 11:01:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66D2B28C59; Mon, 7 Nov 2016 11:01:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D286427B81 for ; Mon, 7 Nov 2016 11:01:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 516CA6E073; Mon, 7 Nov 2016 11:01:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id C89446E073; Mon, 7 Nov 2016 11:01:31 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id c17so15756493wmc.3; Mon, 07 Nov 2016 03:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gMeph5cAoHdATirgsotV9NvT4Qx4/iPQV6dlwyh9SSo=; b=fQjPgk5Z1+eRnjwAWzF8mXunkk8eBv/gDne/QYoQZq206DZrk+ZlYDAIg+uKJ3+EZ+ cv/EmVoOxsj2flbIbf/tLW/lhpGoCvu9v7NCJBf6OcoSVsP2s6yKPS8/NPlAavli8Ol3 mljHPHZxgciKPB/ZWWbA4Z6m60GfZ3m9bJ5PSbFBkePeuA8IyzsWxHTLnyWZaClJJIyo E3RBeVob8Co6EHcZeTlgjWQeT1jY0vNXF8ng3CsoWiznMBJLEX9rqIT0ioRR/5dUZ4Vi J9v5DMYRqrih/62hFf9+TVFl4a7jkOa6rf5/ymVs5+4Li5DKnkS/I5cla9tuyc3M52AT 7XgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gMeph5cAoHdATirgsotV9NvT4Qx4/iPQV6dlwyh9SSo=; b=Lvf19VPudZTybeP/haeISqAjb/rI/aC5iCTaUK1zJQt6r2zK9+e3dqqw4H1wpy9sq0 XXvWUJhJWDTu7XtOeLO1zrq45n0ve/TA4+329hd4w1udupisHtfgLdE/LuxGDTzwKK7R h36SOkwUBMeqomuL0XvuLhQlrAUQVI5RCsu5AqwUU8lN079WJ2XF0wmVTQBiMGjLyaPc ltjzNgBlpUm7h+2N8vHhAoH2aY/FGU6L2ebk4LHCxiOXiQmAxZrA8BmCYqDVJlGEgomZ s73DiXZ5DlAqYr2Jrc7DqS15BWPlkcAO81/N9Zg5IcO12dOmuLZYRyIeWbyY6/Sf0K8R X4nw== X-Gm-Message-State: ABUngve9B5lMi2HeMpQMviT1wW3hf+VhVlpvmQwYPSGHkTy2L9f77+E/ucMUcz/fEfxyhA== X-Received: by 10.28.159.16 with SMTP id i16mr8925911wme.122.1478516490484; Mon, 07 Nov 2016 03:01:30 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id 125sm12841977wmh.14.2016.11.07.03.01.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 03:01:29 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 7 Nov 2016 11:01:28 +0000 Message-Id: <20161107110128.28762-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161104110838.3279-1-chris@chris-wilson.co.uk> References: <20161104110838.3279-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Cc: Akash Goel , "# v4 . 9-rc1+" Subject: [Intel-gfx] [PATCH v4] drm/i915: Limit Valleyview and earlier to only using mappable scanout X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Valleyview appears tobe limited to only scanning out from the first 512MiB of the Global GTT. Lets presume that this behaviour was inherited from the display block copied from g4x (not Ironlake) and all earlier generations are similarly affected, thought testing suggests different symptoms. For simplicity, impose that these platforms must scanout from the mappable region. (For extra simplicity, use HAS_GMCH_DISPLAY even though this catches Cherryview which does not appear to be limited to the low aperture for its scanout.) v2: Use HAS_GMCH_DISPLAY() to more clearly convey my intent about limiting this workaround to the old style of display engine. v3: Update change log to reflect testing by Ville Syrjälä v4: Include the changes to the comments as well Reported-by: Luis Botello Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98036 Fixes: 2efb813d5388 ("drm/i915: Fallback to using unmappable memory for scanout") Signed-off-by: Chris Wilson Cc: Akash Goel Cc: Joonas Lahtinen Cc: Ville Syrjälä Cc: # v4.9-rc1+ Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_gem.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6a2005683f6d..4116809f3ed2 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3673,8 +3673,23 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, if (view->type == I915_GGTT_VIEW_NORMAL) vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, PIN_MAPPABLE | PIN_NONBLOCK); - if (IS_ERR(vma)) - vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, 0); + if (IS_ERR(vma)) { + struct drm_i915_private *i915 = to_i915(obj->base.dev); + unsigned int flags; + + /* Valleyview is definitely limited to scanning out the first + * 512MiB respectively. Lets presume this behaviour was + * inherited from the g4x display engine and that all earlier + * gen are similarly limited. Testing suggests that it is a + * little more complicated than this. For example, Cherryview + * appears quite happy to scanout from anywhere within its + * global aperture. + */ + flags = 0; + if (HAS_GMCH_DISPLAY(i915)) + flags = PIN_MAPPABLE; + vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, flags); + } if (IS_ERR(vma)) goto err_unpin_display;