From patchwork Mon Feb 22 12:07:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Feceoru, Gabriel" X-Patchwork-Id: 8375981 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 91CCC9F372 for ; Mon, 22 Feb 2016 12:00:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFF46204E3 for ; Mon, 22 Feb 2016 12:00:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B998D204D8 for ; Mon, 22 Feb 2016 12:00:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68DA46E169; Mon, 22 Feb 2016 12:00:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id F3BFB6E169 for ; Mon, 22 Feb 2016 12:00:35 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 22 Feb 2016 04:00:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,484,1449561600"; d="scan'208";a="891664157" Received: from gfeceoru-ms-7924.rb.intel.com ([10.237.104.199]) by orsmga001.jf.intel.com with ESMTP; 22 Feb 2016 04:00:28 -0800 From: Gabriel Feceoru To: intel-gfx@lists.freedesktop.org Date: Mon, 22 Feb 2016 14:07:13 +0200 Message-Id: <1456142833-25399-1-git-send-email-gabriel.feceoru@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] drm/i915: Avoid selecting unavailable BSD2 ring 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return error when I915_EXEC_BSD_RING2 flag is set but BSD2 ring is not available in the HW. Signed-off-by: Gabriel Feceoru --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 8fd00d2..47305ec 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1394,19 +1394,22 @@ eb_select_ring(struct drm_i915_private *dev_priv, return -EINVAL; } - if (user_ring_id == I915_EXEC_BSD && HAS_BSD2(dev_priv)) { + if (user_ring_id == I915_EXEC_BSD) { unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK; + if ((!HAS_BSD2(dev_priv) && (bsd_idx != I915_EXEC_BSD_DEFAULT)) || + (bsd_idx == (I915_EXEC_BSD_RING1 | I915_EXEC_BSD_RING2))) { + + DRM_DEBUG("execbuf with wrong bsd ring: %u\n", + bsd_idx); + return -EINVAL; + } + if (bsd_idx == I915_EXEC_BSD_DEFAULT) { bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file); - } else if (bsd_idx >= I915_EXEC_BSD_RING1 && - bsd_idx <= I915_EXEC_BSD_RING2) { + } else { bsd_idx >>= I915_EXEC_BSD_SHIFT; bsd_idx--; - } else { - DRM_DEBUG("execbuf with unknown bsd ring: %u\n", - bsd_idx); - return -EINVAL; } *ring = &dev_priv->ring[_VCS(bsd_idx)];