From patchwork Wed Aug 9 09:27:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 9889959 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 3D6E3602D7 for ; Wed, 9 Aug 2017 09:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B8F22899C for ; Wed, 9 Aug 2017 09:28:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2076328A46; Wed, 9 Aug 2017 09:28:19 +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 9F21C2899C for ; Wed, 9 Aug 2017 09:28:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E7EA6E280; Wed, 9 Aug 2017 09:28:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B64C6E280 for ; Wed, 9 Aug 2017 09:28:17 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 09 Aug 2017 02:28:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.41,346,1498546800"; d="scan'208"; a="1203677573" Received: from rosetta.fi.intel.com ([10.237.72.186]) by fmsmga002.fm.intel.com with ESMTP; 09 Aug 2017 02:28:15 -0700 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 7574F84005B; Wed, 9 Aug 2017 12:27:18 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Wed, 9 Aug 2017 12:27:15 +0300 Message-Id: <20170809092715.10792-1-mika.kuoppala@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH igt] tools/null_state_gen: Add proper color calc and depth stencil states 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 were just pointing these states blindly into the 1k offset in the bb. Make a suitable sized and aligned null block and point both indirect state pointers to that block. v2: move blend state generation into the same function Reported-by: Chris Wilson Signed-off-by: Mika Kuoppala --- tools/null_state_gen/intel_renderstate_gen6.c | 64 ++++++++++++++++----------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/null_state_gen/intel_renderstate_gen6.c b/tools/null_state_gen/intel_renderstate_gen6.c index 5c1b7f97..1aa97d39 100644 --- a/tools/null_state_gen/intel_renderstate_gen6.c +++ b/tools/null_state_gen/intel_renderstate_gen6.c @@ -216,13 +216,46 @@ gen6_emit_invariant(struct intel_batchbuffer *batch) OUT_BATCH(1); } +static uint32_t +gen6_create_cc_blend(struct intel_batchbuffer *batch) +{ + struct gen6_blend_state blend; + + memset(&blend, 0, sizeof(blend)); + + blend.blend0.dest_blend_factor = GEN6_BLENDFACTOR_ZERO; + blend.blend0.source_blend_factor = GEN6_BLENDFACTOR_ONE; + blend.blend0.blend_func = GEN6_BLENDFUNCTION_ADD; + blend.blend0.blend_enable = 1; + + blend.blend1.post_blend_clamp_enable = 1; + blend.blend1.pre_blend_clamp_enable = 1; + + return OUT_STATE_STRUCT(blend, 64); +} + static void -gen6_emit_cc(struct intel_batchbuffer *batch, uint32_t blend) +gen6_emit_cc(struct intel_batchbuffer *batch) { + struct null_blk_s { + union { + struct gen6_depth_stencil_state s_state; + struct gen6_color_calc_state c_state; + }; + } null_block; + uint32_t null_block_offset, blend_offset; + + memset(&null_block, 0, sizeof(null_block)); + + blend_offset = gen6_create_cc_blend(batch); + null_block_offset = OUT_STATE_STRUCT(null_block, 64); + OUT_BATCH(GEN6_3DSTATE_CC_STATE_POINTERS | (4 - 2)); - OUT_BATCH_STATE_OFFSET(blend | 1); - OUT_BATCH(1024 | 1); - OUT_BATCH(1024 | 1); + OUT_BATCH_STATE_OFFSET(blend_offset | 1); + /* color calc state */ + OUT_BATCH_STATE_OFFSET(null_block_offset | 1); + /* depth stencil state */ + OUT_BATCH_STATE_OFFSET(null_block_offset | 1); } static void @@ -354,24 +387,6 @@ gen6_create_cc_viewport(struct intel_batchbuffer *batch) } static uint32_t -gen6_create_cc_blend(struct intel_batchbuffer *batch) -{ - struct gen6_blend_state blend; - - memset(&blend, 0, sizeof(blend)); - - blend.blend0.dest_blend_factor = GEN6_BLENDFACTOR_ZERO; - blend.blend0.source_blend_factor = GEN6_BLENDFACTOR_ONE; - blend.blend0.blend_func = GEN6_BLENDFUNCTION_ADD; - blend.blend0.blend_enable = 1; - - blend.blend1.post_blend_clamp_enable = 1; - blend.blend1.pre_blend_clamp_enable = 1; - - return OUT_STATE_STRUCT(blend, 64); -} - -static uint32_t gen6_create_kernel(struct intel_batchbuffer *batch) { return intel_batch_state_copy(batch, ps_kernel_nomask_affine, @@ -463,7 +478,7 @@ static void gen6_emit_vertex_buffer(struct intel_batchbuffer *batch) void gen6_setup_null_render_state(struct intel_batchbuffer *batch) { uint32_t wm_state, wm_kernel, wm_table; - uint32_t cc_vp, cc_blend; + uint32_t cc_vp; wm_table = gen6_bind_surfaces(batch); wm_kernel = gen6_create_kernel(batch); @@ -472,7 +487,6 @@ void gen6_setup_null_render_state(struct intel_batchbuffer *batch) SAMPLER_EXTEND_NONE); cc_vp = gen6_create_cc_viewport(batch); - cc_blend = gen6_create_cc_blend(batch); gen6_emit_invariant(batch); gen6_emit_state_base_address(batch); @@ -488,7 +502,7 @@ void gen6_setup_null_render_state(struct intel_batchbuffer *batch) gen6_emit_null_depth_buffer(batch); gen6_emit_drawing_rectangle(batch); - gen6_emit_cc(batch, cc_blend); + gen6_emit_cc(batch); gen6_emit_sampler(batch, wm_state); gen6_emit_sf(batch); gen6_emit_wm(batch, wm_kernel);