From patchwork Mon Mar 2 23:42:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jeff.mcgee@intel.com X-Patchwork-Id: 5918121 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38FBDBF440 for ; Mon, 2 Mar 2015 23:21:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74D3620225 for ; Mon, 2 Mar 2015 23:21:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 356EF2024F for ; Mon, 2 Mar 2015 23:21:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E28A46E500; Mon, 2 Mar 2015 15:21:46 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id D88CA6E4F4; Mon, 2 Mar 2015 15:21:44 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 02 Mar 2015 15:19:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,678,1418112000"; d="scan'208";a="535118825" Received: from jeffdesk.fm.intel.com ([10.19.123.159]) by orsmga003.jf.intel.com with ESMTP; 02 Mar 2015 15:21:46 -0800 From: jeff.mcgee@intel.com To: beignet@lists.freedesktop.org Date: Mon, 2 Mar 2015 15:42:39 -0800 Message-Id: <1425339759-19027-2-git-send-email-jeff.mcgee@intel.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1425339759-19027-1-git-send-email-jeff.mcgee@intel.com> References: <1425339759-19027-1-git-send-email-jeff.mcgee@intel.com> Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 2/2] Query the driver directly for compute units and subslice 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, T_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 From: Jeff McGee Values of device max compute units and max subslice obtained directly from the driver should be more accurate than our own ID-based lookup values. This is particularly important when a single device ID may encompass more than one configuration. If the driver cannot provide a valid value for the given device, we fallback on the ID-based lookup value. Signed-off-by: Jeff McGee --- src/intel/intel_driver.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c index d61988c..d99fea9 100644 --- a/src/intel/intel_driver.c +++ b/src/intel/intel_driver.c @@ -757,10 +757,8 @@ static int intel_buffer_set_tiling(cl_buffer bo, static void intel_update_device_info(cl_device_id device) { -#ifdef HAS_USERPTR intel_driver_t *driver; - const size_t sz = 4096; - void *host_ptr; + unsigned int eu_total, subslice_total; driver = intel_driver_new(); assert(driver != NULL); @@ -769,6 +767,10 @@ intel_update_device_info(cl_device_id device) return; } +#ifdef HAS_USERPTR + const size_t sz = 4096; + void *host_ptr; + host_ptr = cl_aligned_malloc(sz, 4096); if (host_ptr != NULL) { cl_buffer bo = intel_buffer_alloc_userptr((cl_buffer_mgr)driver->bufmgr, @@ -781,12 +783,18 @@ intel_update_device_info(cl_device_id device) } else device->host_unified_memory = CL_FALSE; +#endif + + /* Prefer driver-queried value if supported */ + if (!drm_intel_get_eu_total(driver->fd, &eu_total)) + device->max_compute_unit = eu_total; + if (!drm_intel_get_subslice_total(driver->fd, &subslice_total)) + device->sub_slice_count = subslice_total; intel_driver_context_destroy(driver); intel_driver_close(driver); intel_driver_terminate(driver); intel_driver_delete(driver); -#endif } LOCAL void