From patchwork Tue Nov 12 22:23:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Welty, Brian" X-Patchwork-Id: 11240303 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 62B6215AB for ; Tue, 12 Nov 2019 22:23:13 +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 40DF121A49 for ; Tue, 12 Nov 2019 22:23:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40DF121A49 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A8216EC05; Tue, 12 Nov 2019 22:23:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 507A36EC05 for ; Tue, 12 Nov 2019 22:23:11 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 14:23:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,297,1569308400"; d="scan'208";a="198241065" Received: from nperf12.hd.intel.com ([10.127.88.161]) by orsmga008.jf.intel.com with ESMTP; 12 Nov 2019 14:23:08 -0800 From: Brian Welty To: Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [RFC PATCH libdrm] intel: Handle GET_TILING errors on unsupported platforms Date: Tue, 12 Nov 2019 17:23:53 -0500 Message-Id: <20191112222353.2100-1-brian.welty@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For gen12+ architectures, i915 no longer supports use of GET_TILING ioctl [1]. This breaks the usage of two libdrm functions on those platforms: drm_intel_bo_gem_create_from_name() and drm_intel_bo_gem_create_from_prime(). We also have IGTs which test drm_intel_gem_bo_flink() followed by drm_intel_bo_gem_create_from_name(), which now fail on these platforms. As I don't know best fix, this patch is mainly to show the problem and get feedback on what is preferred solution. The proposed solution here is to simply have libdrm ignore EOPNOTSUPP errors and leave the tiling mode set to 0 upon receiving that error. [1] https://lists.freedesktop.org/archives/intel-gfx/2019-August/210960.html Signed-off-by: Brian Welty --- intel/intel_bufmgr_gem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index a0cecc96..5160aef1 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1152,7 +1152,8 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling); - if (ret != 0) + /* for EOPNOTSUPP, just use tiling_mode of 0 */ + if (ret != 0 && errno != EOPNOTSUPP) goto err_unref; bo_gem->tiling_mode = get_tiling.tiling_mode; @@ -2753,7 +2754,9 @@ drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr, int prime_fd, int s if (drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling)) - goto err; + /* for EOPNOTSUPP, just use tiling_mode of 0 */ + if (errno != EOPNOTSUPP) + goto err; bo_gem->tiling_mode = get_tiling.tiling_mode; bo_gem->swizzle_mode = get_tiling.swizzle_mode;