From patchwork Tue Nov 13 07:45:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Lisovskiy X-Patchwork-Id: 10679987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C053514E2 for ; Tue, 13 Nov 2018 07:45:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B01E82A42B for ; Tue, 13 Nov 2018 07:45:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A45B12A437; Tue, 13 Nov 2018 07:45:12 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 2E7D72A42B for ; Tue, 13 Nov 2018 07:45:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32A276E2C4; Tue, 13 Nov 2018 07:45:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DC9F6E2C4; Tue, 13 Nov 2018 07:45:07 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2018 23:45:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,498,1534834800"; d="scan'208";a="95881898" Received: from slisovsk-lenovo-ideapad-720s-13ikb.fi.intel.com ([10.237.66.156]) by FMSMGA003.fm.intel.com with ESMTP; 12 Nov 2018 23:45:05 -0800 From: Stanislav Lisovskiy To: intel-gfx@lists.freedesktop.org Subject: [PATCH xf86-video-intel v8 1/2] sna/gen9+: Split out wm_kernel from the sna_composite_op flags Date: Tue, 13 Nov 2018 09:45:01 +0200 Message-Id: <20181113074502.31063-2-stanislav.lisovskiy@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181113074502.31063-1-stanislav.lisovskiy@intel.com> References: <20181113074502.31063-1-stanislav.lisovskiy@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ville.syrjala@intel.com, martin.peres@intel.com, dri-devel@lists.freedesktop.org, stanislav.lisovskiy@intel.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the extra video kernels we already ran out of bits in the flags. To tackle that let's just split out the wm_kernel to its own thing. Signed-off-by: Stanislav Lisovskiy --- src/sna/gen9_render.c | 35 ++++++++++++++++++++++------------- src/sna/sna_render.h | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/sna/gen9_render.c b/src/sna/gen9_render.c index 505b98af..eb22b642 100644 --- a/src/sna/gen9_render.c +++ b/src/sna/gen9_render.c @@ -226,19 +226,18 @@ static const struct blendinfo { #define COPY_SAMPLER 0 #define COPY_VERTEX VERTEX_2s2s -#define COPY_FLAGS(a) GEN9_SET_FLAGS(COPY_SAMPLER, (a) == GXcopy ? NO_BLEND : CLEAR, GEN9_WM_KERNEL_NOMASK, COPY_VERTEX) +#define COPY_FLAGS(a) GEN9_SET_FLAGS(COPY_SAMPLER, (a) == GXcopy ? NO_BLEND : CLEAR, COPY_VERTEX) #define FILL_SAMPLER 1 #define FILL_VERTEX VERTEX_2s2s -#define FILL_FLAGS(op, format) GEN9_SET_FLAGS(FILL_SAMPLER, gen9_get_blend((op), false, (format)), GEN9_WM_KERNEL_NOMASK, FILL_VERTEX) -#define FILL_FLAGS_NOBLEND GEN9_SET_FLAGS(FILL_SAMPLER, NO_BLEND, GEN9_WM_KERNEL_NOMASK, FILL_VERTEX) +#define FILL_FLAGS(op, format) GEN9_SET_FLAGS(FILL_SAMPLER, gen9_get_blend((op), false, (format)), FILL_VERTEX) +#define FILL_FLAGS_NOBLEND GEN9_SET_FLAGS(FILL_SAMPLER, NO_BLEND, FILL_VERTEX) #define GEN9_SAMPLER(f) (((f) >> 20) & 0xfff) #define GEN9_BLEND(f) (((f) >> 4) & 0x7ff) #define GEN9_READS_DST(f) (((f) >> 15) & 1) -#define GEN9_KERNEL(f) (((f) >> 16) & 0xf) #define GEN9_VERTEX(f) (((f) >> 0) & 0xf) -#define GEN9_SET_FLAGS(S, B, K, V) ((S) << 20 | (K) << 16 | (B) | (V)) +#define GEN9_SET_FLAGS(S, B, V) ((S) << 20 | (B) | (V)) #define OUT_BATCH(v) batch_emit(sna, v) #define OUT_BATCH64(v) batch_emit64(sna, v) @@ -1349,7 +1348,7 @@ gen9_emit_state(struct sna *sna, gen9_emit_cc(sna, GEN9_BLEND(op->u.gen9.flags)); gen9_emit_sampler(sna, GEN9_SAMPLER(op->u.gen9.flags)); gen9_emit_sf(sna, GEN9_VERTEX(op->u.gen9.flags) >> 2); - gen9_emit_wm(sna, GEN9_KERNEL(op->u.gen9.flags)); + gen9_emit_wm(sna, op->u.gen9.wm_kernel); gen9_emit_vertex_elements(sna, op); gen9_emit_binding_table(sna, wm_binding_table); @@ -1618,7 +1617,7 @@ static int gen9_get_rectangles__flush(struct sna *sna, if (gen9_magic_ca_pass(sna, op)) { gen9_emit_pipe_invalidate(sna); gen9_emit_cc(sna, GEN9_BLEND(op->u.gen9.flags)); - gen9_emit_wm(sna, GEN9_KERNEL(op->u.gen9.flags)); + gen9_emit_wm(sna, op->u.gen9.wm_kernel); } } @@ -2548,11 +2547,11 @@ gen9_render_composite(struct sna *sna, gen9_get_blend(tmp->op, tmp->has_component_alpha, tmp->dst.format), - gen9_choose_composite_kernel(tmp->op, - tmp->mask.bo != NULL, - tmp->has_component_alpha, - tmp->is_affine), gen4_choose_composite_emitter(sna, tmp)); + tmp->u.gen9.wm_kernel = gen9_choose_composite_kernel(tmp->op, + tmp->mask.bo != NULL, + tmp->has_component_alpha, + tmp->is_affine); tmp->blt = gen9_render_composite_blt; tmp->box = gen9_render_composite_box; @@ -2781,8 +2780,9 @@ gen9_render_composite_spans(struct sna *sna, SAMPLER_FILTER_NEAREST, SAMPLER_EXTEND_PAD), gen9_get_blend(tmp->base.op, false, tmp->base.dst.format), - GEN9_WM_KERNEL_OPACITY | !tmp->base.is_affine, gen4_choose_spans_emitter(sna, tmp)); + tmp->base.u.gen9.wm_kernel = + GEN9_WM_KERNEL_OPACITY | !tmp->base.is_affine; tmp->box = gen9_render_composite_spans_box; tmp->boxes = gen9_render_composite_spans_boxes; @@ -3045,6 +3045,7 @@ fallback_blt: tmp.need_magic_ca_pass = 0; tmp.u.gen9.flags = COPY_FLAGS(alu); + tmp.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, tmp.dst.bo); if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, tmp.src.bo, NULL)) { @@ -3214,6 +3215,7 @@ fallback: op->base.floats_per_rect = 6; op->base.u.gen9.flags = COPY_FLAGS(alu); + op->base.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo); if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL)) { @@ -3366,6 +3368,7 @@ gen9_render_fill_boxes(struct sna *sna, tmp.need_magic_ca_pass = false; tmp.u.gen9.flags = FILL_FLAGS(op, format); + tmp.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo); if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) { @@ -3552,6 +3555,7 @@ gen9_render_fill(struct sna *sna, uint8_t alu, op->base.floats_per_rect = 6; op->base.u.gen9.flags = FILL_FLAGS_NOBLEND; + op->base.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo); if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) { @@ -3637,6 +3641,7 @@ gen9_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo, tmp.need_magic_ca_pass = false; tmp.u.gen9.flags = FILL_FLAGS_NOBLEND; + tmp.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, bo); if (!kgem_check_bo(&sna->kgem, bo, NULL)) { @@ -3723,6 +3728,7 @@ gen9_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo) tmp.need_magic_ca_pass = false; tmp.u.gen9.flags = FILL_FLAGS_NOBLEND; + tmp.u.gen9.wm_kernel = GEN9_WM_KERNEL_NOMASK; kgem_set_mode(&sna->kgem, KGEM_RENDER, bo); if (!kgem_check_bo(&sna->kgem, bo, NULL)) { @@ -3964,8 +3970,8 @@ gen9_render_video(struct sna *sna, GEN9_SET_FLAGS(SAMPLER_OFFSET(filter, SAMPLER_EXTEND_PAD, SAMPLER_FILTER_NEAREST, SAMPLER_EXTEND_NONE), NO_BLEND, - select_video_kernel(video, frame), 2); + tmp.u.gen9.wm_kernel = select_video_kernel(video, frame); tmp.priv = frame; kgem_set_mode(&sna->kgem, KGEM_RENDER, tmp.dst.bo); @@ -4135,6 +4141,9 @@ static bool gen9_render_setup(struct sna *sna) assert(state->wm_kernel[m][0]|state->wm_kernel[m][1]|state->wm_kernel[m][2]); } + COMPILE_TIME_ASSERT(GEN9_WM_KERNEL_COUNT <= + 1 << (sizeof(((struct sna_composite_op *)NULL)->u.gen9.wm_kernel) * 8)); + COMPILE_TIME_ASSERT(SAMPLER_OFFSET(FILTER_COUNT, EXTEND_COUNT, FILTER_COUNT, EXTEND_COUNT) <= 0x7ff); ss = sna_static_stream_map(&general, 2 * sizeof(*ss) * diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h index 6669af9d..a4e5b56a 100644 --- a/src/sna/sna_render.h +++ b/src/sna/sna_render.h @@ -151,6 +151,7 @@ struct sna_composite_op { struct { uint32_t flags; + uint8_t wm_kernel; } gen9; } u;