From 70251e36314f7053ea62c93f69685f37d4a2ff58 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Tue, 9 May 2017 17:12:12 -0700 Subject: [PATCH] i965: Port 3DSTATE_VF_TOPOLOGY on gen8+ to genxml. With this last state ported, we can get rid of gen8_draw_upload.c. Signed-off-by: Rafael Antognolli Reviewed-by: Lionel Landwerlin --- src/mesa/drivers/dri/i965/Makefile.sources | 1 - src/mesa/drivers/dri/i965/brw_state.h | 1 - src/mesa/drivers/dri/i965/gen8_draw_upload.c | 53 ------------------- src/mesa/drivers/dri/i965/genX_state_upload.c | 22 +++++++- 4 files changed, 21 insertions(+), 56 deletions(-) diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index 349777cf24a..d4e0bfd1a8f 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -91,7 +91,6 @@ i965_FILES = \ gen7_urb.c \ gen7_wm_surface_state.c \ gen8_depth_state.c \ - gen8_draw_upload.c \ gen8_multisample_state.c \ gen8_surface_state.c \ hsw_queryobj.c \ diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 525521d4ce3..954969c4bf8 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -112,7 +112,6 @@ extern const struct brw_tracked_state gen7_l3_state; extern const struct brw_tracked_state gen7_push_constant_space; extern const struct brw_tracked_state gen7_urb; extern const struct brw_tracked_state gen8_pma_fix; -extern const struct brw_tracked_state gen8_vf_topology; extern const struct brw_tracked_state brw_cs_work_groups_surface; static inline bool diff --git a/src/mesa/drivers/dri/i965/gen8_draw_upload.c b/src/mesa/drivers/dri/i965/gen8_draw_upload.c index 01c3ac3e9a2..e69de29bb2d 100644 --- a/src/mesa/drivers/dri/i965/gen8_draw_upload.c +++ b/src/mesa/drivers/dri/i965/gen8_draw_upload.c @@ -1,53 +0,0 @@ -/* - * Copyright © 2012 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include "main/bufferobj.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/macros.h" - -#include "brw_draw.h" -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_state.h" - -#include "intel_batchbuffer.h" -#include "intel_buffer_objects.h" - -static void -gen8_emit_vf_topology(struct brw_context *brw) -{ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_VF_TOPOLOGY << 16 | (2 - 2)); - OUT_BATCH(brw->primitive); - ADVANCE_BATCH(); -} - -const struct brw_tracked_state gen8_vf_topology = { - .dirty = { - .mesa = 0, - .brw = BRW_NEW_BLORP | - BRW_NEW_PRIMITIVE, - }, - .emit = gen8_emit_vf_topology, -}; diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index a0eedb5dc60..3921a6f2d4b 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -4046,7 +4046,27 @@ static const struct brw_tracked_state genX(ps_blend) = { }, .emit = genX(upload_ps_blend) }; +#endif + +/* ---------------------------------------------------------------------- */ + +#if GEN_GEN >= 8 +static void +genX(emit_vf_topology)(struct brw_context *brw) +{ + brw_batch_emit(brw, GENX(3DSTATE_VF_TOPOLOGY), vftopo) { + vftopo.PrimitiveTopologyType = brw->primitive; + } +} +static const struct brw_tracked_state genX(vf_topology) = { + .dirty = { + .mesa = 0, + .brw = BRW_NEW_BLORP | + BRW_NEW_PRIMITIVE, + }, + .emit = genX(emit_vf_topology), +}; #endif /* ---------------------------------------------------------------------- */ @@ -4384,7 +4404,7 @@ genX(init_atoms)(struct brw_context *brw) &genX(drawing_rect), - &gen8_vf_topology, + &genX(vf_topology), &brw_indices, &genX(index_buffer), -- 2.30.2