From patchwork Sat Dec 21 14:54:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWFyZWsgT2zFocOhaw==?= X-Patchwork-Id: 3393571 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1C6FBC0D4A for ; Sat, 21 Dec 2013 14:54:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C023206B7 for ; Sat, 21 Dec 2013 14:54:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5B7C72069A for ; Sat, 21 Dec 2013 14:54:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20DA8FA2E3; Sat, 21 Dec 2013 06:54:40 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by gabe.freedesktop.org (Postfix) with ESMTP id A5453FA2E3 for ; Sat, 21 Dec 2013 06:54:37 -0800 (PST) Received: by mail-ee0-f51.google.com with SMTP id b15so1555162eek.24 for ; Sat, 21 Dec 2013 06:54:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=BYNEHsdz3yi3Kx77bLaHGOxUHqD4vyjiPO3MvL0IqbY=; b=gqTMKyc8UhiITj8NSxz1th+FtfloPEw5IM/krtwI/7YH3/iRFEDxOarOMgto+b73Ps JkFfFH4iLOAfWmMeMQTuwsKvCmCH2OJHFVLG0do33c8Waww9mq423LG4SuOfdLajlDAd XtD3xfac1AHrV0I6cA5nbOP1ScG7raabGwl1//BhJDAJG3gFXH/TP2TUJ7qUGeDqRcGW uexv+OVhTJSsZvtT+r+FbJg5G9tCqQyAel17UADlsrLACn1CecM9EvHWQWCNKNReD2k1 gsR3c1OtDaAIqrMG0Acd27/9jt6zb4720TH6gzS99zaUyeq3EkEBaiOfrQEehylE0/Y1 fkZg== X-Received: by 10.14.0.201 with SMTP id 49mr11052478eeb.38.1387637676371; Sat, 21 Dec 2013 06:54:36 -0800 (PST) Received: from localhost.localdomain ([194.228.11.87]) by mx.google.com with ESMTPSA id g7sm28198164eet.12.2013.12.21.06.54.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 21 Dec 2013 06:54:35 -0800 (PST) From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: add a way to query the number of render backends on SI and CIK Date: Sat, 21 Dec 2013 15:54:31 +0100 Message-Id: <1387637671-24152-1-git-send-email-maraeo@gmail.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Marek Olšák Needed by userspace for HTILE buffer size calculations. Signed-off-by: Marek Olšák --- It returns 2 on Bonaire. I hope it's correct. drivers/gpu/drm/radeon/cik.c | 7 ++++++- drivers/gpu/drm/radeon/radeon_kms.c | 9 +++++++++ drivers/gpu/drm/radeon/si.c | 7 ++++++- include/uapi/drm/radeon_drm.h | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index b43a3a3..ccbbeb1 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -3094,6 +3094,7 @@ static void cik_setup_rb(struct radeon_device *rdev, u32 data, mask; u32 disabled_rbs = 0; u32 enabled_rbs = 0; + u32 num_enabled_rbs = 0; for (i = 0; i < se_num; i++) { for (j = 0; j < sh_per_se; j++) { @@ -3109,8 +3110,10 @@ static void cik_setup_rb(struct radeon_device *rdev, mask = 1; for (i = 0; i < max_rb_num; i++) { - if (!(disabled_rbs & mask)) + if (!(disabled_rbs & mask)) { enabled_rbs |= mask; + num_enabled_rbs++; + } mask <<= 1; } @@ -3141,6 +3144,8 @@ static void cik_setup_rb(struct radeon_device *rdev, WREG32(PA_SC_RASTER_CONFIG, data); } cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); + + rdev->config.cik.num_backends_per_se = num_enabled_rbs; } /** diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 55d0b47..39d22de 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -461,6 +461,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) case RADEON_INFO_SI_CP_DMA_COMPUTE: *value = 1; break; + case RADEON_INFO_SI_NUM_RENDER_BACKENDS: + if (rdev->family >= CHIP_BONAIRE) { + *value = rdev->config.cik.num_backends_per_se; + } else if (rdev->family >= CHIP_TAHITI) { + *value = rdev->config.si.num_backends_per_se; + } else { + DRM_DEBUG_KMS("INFO_SI_NUM_RENDER_BACKENDS is si+ only!\n"); + } + break; default: DRM_DEBUG_KMS("Invalid request %d\n", info->request); return -EINVAL; diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index a36736d..0e730d6 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -2838,6 +2838,7 @@ static void si_setup_rb(struct radeon_device *rdev, u32 data, mask; u32 disabled_rbs = 0; u32 enabled_rbs = 0; + u32 num_enabled_rbs = 0; for (i = 0; i < se_num; i++) { for (j = 0; j < sh_per_se; j++) { @@ -2850,8 +2851,10 @@ static void si_setup_rb(struct radeon_device *rdev, mask = 1; for (i = 0; i < max_rb_num; i++) { - if (!(disabled_rbs & mask)) + if (!(disabled_rbs & mask)) { enabled_rbs |= mask; + num_enabled_rbs++; + } mask <<= 1; } @@ -2876,6 +2879,8 @@ static void si_setup_rb(struct radeon_device *rdev, WREG32(PA_SC_RASTER_CONFIG, data); } si_select_se_sh(rdev, 0xffffffff, 0xffffffff); + + rdev->config.si.num_backends_per_se = num_enabled_rbs; } static void si_gpu_init(struct radeon_device *rdev) diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h index 2f3f7ea..a64713a 100644 --- a/include/uapi/drm/radeon_drm.h +++ b/include/uapi/drm/radeon_drm.h @@ -983,6 +983,8 @@ struct drm_radeon_cs { #define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17 /* CIK macrotile mode array */ #define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18 +/* query the number of render backends */ +#define RADEON_INFO_SI_NUM_RENDER_BACKENDS 0x19 struct drm_radeon_info {