From patchwork Thu Nov 7 20:37:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 11233747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C9D614E5 for ; Thu, 7 Nov 2019 20:36:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23B5E20869 for ; Thu, 7 Nov 2019 20:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23B5E20869 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 867D86F7A3; Thu, 7 Nov 2019 20:36:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id E90286F7A3 for ; Thu, 7 Nov 2019 20:36:22 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 12:36:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,279,1569308400"; d="scan'208";a="353904768" Received: from mdroper-desk1.fm.intel.com ([10.1.27.135]) by orsmga004.jf.intel.com with ESMTP; 07 Nov 2019 12:36:22 -0800 From: Matt Roper To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Nov 2019 12:37:22 -0800 Message-Id: <20191107203722.8814-1-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: Don't test plane stride with !INTEL_DISPLAY_ENABLED X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula , Lucas De Marchi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If INTEL_DISPLAY_ENABLED is false, then the modesetting resources were never initialized. Userspace may still call DRM_IOCTL_MODE_CREATE_DUMB which will eventually lead i915_gem_dumb_create() to try to dereference a non-existent pipe A primary plane while figuring out a proper pitch. We could force dumb buffer creation to fail in cases where display isn't enabled (since there isn't really a definition of a "suitable for scanout" buffer in that case), but it's easier (and probably less invasive to IGT tests) to just drop the attempt to align to plane max stride in cases where the display isn't enabled. Cc: Lucas De Marchi Cc: Jani Nikula Signed-off-by: Matt Roper --- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 143a8952b736..f022a17328b0 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -229,7 +229,8 @@ i915_gem_dumb_create(struct drm_file *file, args->pitch = ALIGN(args->width * cpp, 64); /* align stride to page size so that we can remap */ - if (args->pitch > intel_plane_fb_max_stride(to_i915(dev), format, + if (INTEL_DISPLAY_ENABLED(to_i915(dev)) && + args->pitch > intel_plane_fb_max_stride(to_i915(dev), format, DRM_FORMAT_MOD_LINEAR)) args->pitch = ALIGN(args->pitch, 4096);