From patchwork Fri Jul 17 09:25:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Zeromski X-Patchwork-Id: 6814511 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D8BC99F358 for ; Fri, 17 Jul 2015 09:26:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5535205F1 for ; Fri, 17 Jul 2015 09:26:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DDD74205EE for ; Fri, 17 Jul 2015 09:26:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B3BFA6ED3F; Fri, 17 Jul 2015 02:26:23 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id B3A976ED3F for ; Fri, 17 Jul 2015 02:26:22 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 17 Jul 2015 02:26:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,495,1432623600"; d="scan'208";a="764415337" Received: from gklab-42-032.igk.intel.com ([10.102.42.32]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2015 02:26:21 -0700 From: Dominik Zeromski To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Jul 2015 11:25:45 +0200 Message-Id: <1437125145-8711-4-git-send-email-dominik.zeromski@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1437125145-8711-1-git-send-email-dominik.zeromski@intel.com> References: <1437125145-8711-1-git-send-email-dominik.zeromski@intel.com> Cc: Thomas Wood Subject: [Intel-gfx] [PATCH i-g-t 3/3] lib/gpgpu_fill: Add SKL support 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=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 SKL changed state base address command. Cc: Thomas Wood Signed-off-by: Dominik Zeromski --- lib/gpgpu_fill.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/gpgpu_fill.h | 7 ++++ lib/intel_batchbuffer.c | 2 + 3 files changed, 111 insertions(+) diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c index c98f121..4d98643 100755 --- a/lib/gpgpu_fill.c +++ b/lib/gpgpu_fill.c @@ -62,6 +62,19 @@ static const uint32_t gen8_gpgpu_kernel[][4] = { { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, }; +static const uint32_t gen9_gpgpu_kernel[][4] = { + { 0x00400001, 0x20202288, 0x00000020, 0x00000000 }, + { 0x00000041, 0x20400208, 0x06000004, 0x00000010 }, + { 0x00000001, 0x20440208, 0x00000018, 0x00000000 }, + { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, + { 0x00200001, 0x20800208, 0x00450040, 0x00000000 }, + { 0x00000001, 0x20880608, 0x00000000, 0x0000000f }, + { 0x00800001, 0x20a00208, 0x00000020, 0x00000000 }, + { 0x0c800031, 0x24000a40, 0x06000080, 0x060a8000 }, + { 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 }, + { 0x07800031, 0x20000a40, 0x06000e00, 0x82000010 }, +}; + static uint32_t batch_used(struct intel_batchbuffer *batch) { @@ -390,6 +403,47 @@ gen8_emit_state_base_address(struct intel_batchbuffer *batch) } static void +gen9_emit_state_base_address(struct intel_batchbuffer *batch) +{ + OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (19 - 2)); + + /* general */ + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0); + + /* stateless data port */ + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + + /* surface */ + OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY); + + /* dynamic */ + OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION, + 0, BASE_ADDRESS_MODIFY); + + /* indirect */ + OUT_BATCH(0); + OUT_BATCH(0); + + /* instruction */ + OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY); + + /* general state buffer size */ + OUT_BATCH(0xfffff000 | 1); + /* dynamic state buffer size */ + OUT_BATCH(1 << 12 | 1); + /* indirect object buffer size */ + OUT_BATCH(0xfffff000 | 1); + /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */ + OUT_BATCH(1 << 12 | 1); + + /* Bindless surface state base address */ + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0); + OUT_BATCH(0xfffff000); +} + +static void gen7_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch) { OUT_BATCH(GEN7_MEDIA_VFE_STATE | (8 - 2)); @@ -704,3 +758,51 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch, gen7_render_flush(batch, batch_end); intel_batchbuffer_reset(batch); } + +void +gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch, + struct igt_buf *dst, + unsigned x, unsigned y, + unsigned width, unsigned height, + uint8_t color) +{ + uint32_t curbe_buffer, interface_descriptor; + uint32_t batch_end; + + intel_batchbuffer_flush(batch); + + /* setup states */ + batch->ptr = &batch->buffer[BATCH_STATE_SPLIT]; + + /* + * const buffer needs to fill for every thread, but as we have just 1 thread + * per every group, so need only one curbe data. + * + * For each thread, just use thread group ID for buffer offset. + */ + curbe_buffer = gen7_fill_curbe_buffer_data(batch, color); + + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, + gen9_gpgpu_kernel, + sizeof(gen9_gpgpu_kernel)); + igt_assert(batch->ptr < &batch->buffer[4095]); + + batch->ptr = batch->buffer; + + /* GPGPU pipeline */ + OUT_BATCH(GEN7_PIPELINE_SELECT | PIPELINE_SELECT_GPGPU); + + gen9_emit_state_base_address(batch); + gen8_emit_vfe_state_gpgpu(batch); + gen7_emit_curbe_load(batch, curbe_buffer); + gen7_emit_interface_descriptor_load(batch, interface_descriptor); + gen8_emit_gpgpu_walk(batch, x, y, width, height); + + OUT_BATCH(MI_BATCH_BUFFER_END); + + batch_end = batch_align(batch, 8); + igt_assert(batch_end < BATCH_STATE_SPLIT); + + gen7_render_flush(batch, batch_end); + intel_batchbuffer_reset(batch); +} diff --git a/lib/gpgpu_fill.h b/lib/gpgpu_fill.h index 2d14881..7b5c832 100644 --- a/lib/gpgpu_fill.h +++ b/lib/gpgpu_fill.h @@ -41,4 +41,11 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch, unsigned width, unsigned height, uint8_t color); +void +gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch, + struct igt_buf *dst, + unsigned x, unsigned y, + unsigned width, unsigned height, + uint8_t color); + #endif /* GPGPU_FILL_H */ diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 7bef11a..0fa47d8 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -789,6 +789,8 @@ igt_fillfunc_t igt_get_gpgpu_fillfunc(int devid) fill = gen7_gpgpu_fillfunc; else if (IS_BROADWELL(devid)) fill = gen8_gpgpu_fillfunc; + else if (IS_GEN9(devid)) + fill = gen9_gpgpu_fillfunc; return fill; }