From patchwork Thu Jul 6 23:27:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 9829223 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 A1261602CA for ; Thu, 6 Jul 2017 23:27:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FF4526B41 for ; Thu, 6 Jul 2017 23:27:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84CEF2855E; Thu, 6 Jul 2017 23:27:26 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 3147E26B41 for ; Thu, 6 Jul 2017 23:27:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 858046E683; Thu, 6 Jul 2017 23:27:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (zangief.bwidawsk.net [107.170.211.233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E0676E69C; Thu, 6 Jul 2017 23:27:17 +0000 (UTC) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id CED821226A9; Thu, 6 Jul 2017 16:27:16 -0700 (PDT) Received: from bolo_yeung.intel.com (unknown [134.134.139.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.bwidawsk.net (Postfix) with ESMTPSA id 599C31226AB; Thu, 6 Jul 2017 16:27:08 -0700 (PDT) From: Ben Widawsky To: Intel GFX , mesa-dev Date: Thu, 6 Jul 2017 16:27:03 -0700 Message-Id: <20170706232703.14229-4-ben@bwidawsk.net> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170706232703.14229-1-ben@bwidawsk.net> References: <20170706232703.14229-1-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 3/3] intel: Make driver aware of MOCS table version 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-Virus-Scanned: ClamAV using ClamSMTP We don't yet have optimal MOCS settings, but we have enough to know how to at least determine when we might have non-optimal settings within our driver. Signed-off-by: Ben Widawsky --- src/intel/vulkan/anv_device.c | 12 ++++++++++++ src/intel/vulkan/anv_private.h | 2 ++ src/mesa/drivers/dri/i915/intel_context.c | 7 ++++++- src/mesa/drivers/dri/i965/intel_screen.c | 14 ++++++++++++++ src/mesa/drivers/dri/i965/intel_screen.h | 2 ++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 3dc55dbb8d..8e180dbf18 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -368,6 +368,18 @@ anv_physical_device_init(struct anv_physical_device *device, device->info.max_cs_threads = max_cs_threads; } + if (device->info.gen >= 9) { + device->mocs_version = anv_gem_get_param(fd, + I915_PARAM_MOCS_TABLE_VERSION); + switch (device->mocs_version) { + default: + anv_perf_warn("Kernel exposes newer MOCS table\n"); + case 1: + case 0: + device->mocs_version = MOCS_TABLE_VERSION; + } + } + brw_process_intel_debug_variable(); device->compiler = brw_compiler_create(NULL, &device->info); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 573778dad5..b8241a9b22 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -684,6 +684,8 @@ struct anv_physical_device { uint32_t eu_total; uint32_t subslice_total; + uint8_t mocs_version; + struct { uint32_t type_count; struct anv_memory_type types[VK_MAX_MEMORY_TYPES]; diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index e0766a0e3f..9169ea650e 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -521,8 +521,13 @@ intelInitContext(struct intel_context *intel, INTEL_DEBUG = parse_debug_string(getenv("INTEL_DEBUG"), debug_control); if (INTEL_DEBUG & DEBUG_BUFMGR) dri_bufmgr_set_debug(intel->bufmgr, true); - if (INTEL_DEBUG & DEBUG_PERF) + if (INTEL_DEBUG & DEBUG_PERF) { intel->perf_debug = true; + if (screen->mocs_version > MOCS_TABLE_VERSION) { + fprintf(stderr, "Kernel exposes newer MOCS table\n"); + screen->mocs_version = MOCS_TABLE_VERSION; + } + } if (INTEL_DEBUG & DEBUG_AUB) drm_intel_bufmgr_gem_set_aub_dump(intel->bufmgr, true); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index c75f2125d4..c53f133d49 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -2301,6 +2301,20 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen) (ret != -1 || errno != EINVAL); } + if (devinfo->gen >= 9) { + screen->mocs_version = intel_get_integer(screen, + I915_PARAM_MOCS_TABLE_VERSION); + switch (screen->mocs_version) { + case 1: + case 0: + screen->mocs_version = MOCS_TABLE_VERSION; + break; + default: + /* We want to perf debug, but we can't yet */ + break; + } + } + dri_screen->extensions = !screen->has_context_reset_notification ? screenExtensions : intelRobustScreenExtensions; diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h index f78b3e8f74..eb801f8155 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.h +++ b/src/mesa/drivers/dri/i965/intel_screen.h @@ -112,6 +112,8 @@ struct intel_screen bool mesa_format_supports_texture[MESA_FORMAT_COUNT]; bool mesa_format_supports_render[MESA_FORMAT_COUNT]; enum isl_format mesa_to_isl_render_format[MESA_FORMAT_COUNT]; + + unsigned mocs_version; }; extern void intelDestroyContext(__DRIcontext * driContextPriv);