summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-16 12:29:07 -0800
committerJason Ekstrand <[email protected]>2015-11-16 12:29:09 -0800
commitde54b4b18fea9358cc6f0e7dc9f64256be00be06 (patch)
treee679f5ee3fe2d5ee4e3a8784ef4b1871d5de5d5d
parentcb9e2305f87e7f3bad5a1b619f5679b335052d46 (diff)
anv: Only include the pack headers where needed
Previously, we were including gen7_pack.h, gen75_pack.h, and gen8_pack.h in anv_private.h. As we add more gens, this is going to become untenable. This commit moves things around so that we only use the pack headers when and if we need them.
-rw-r--r--src/vulkan/anv_batch_chain.c3
-rw-r--r--src/vulkan/anv_device.c2
-rw-r--r--src/vulkan/anv_formats.c2
-rw-r--r--src/vulkan/anv_image.c5
-rw-r--r--src/vulkan/anv_pipeline.c2
-rw-r--r--src/vulkan/anv_private.h29
-rw-r--r--src/vulkan/gen7_cmd_buffer.c4
-rw-r--r--src/vulkan/gen7_pipeline.c12
-rw-r--r--src/vulkan/gen7_state.c4
-rw-r--r--src/vulkan/gen8_cmd_buffer.c6
-rw-r--r--src/vulkan/gen8_pipeline.c2
-rw-r--r--src/vulkan/gen8_state.c2
12 files changed, 46 insertions, 27 deletions
diff --git a/src/vulkan/anv_batch_chain.c b/src/vulkan/anv_batch_chain.c
index 239149709df..9d35da8024b 100644
--- a/src/vulkan/anv_batch_chain.c
+++ b/src/vulkan/anv_batch_chain.c
@@ -29,6 +29,9 @@
#include "anv_private.h"
+#include "gen7_pack.h"
+#include "gen8_pack.h"
+
/** \file anv_batch_chain.c
*
* This file contains functions related to anv_cmd_buffer as a data
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index fb608592c1f..6cdfd4e5c46 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -31,6 +31,8 @@
#include "mesa/main/git_sha1.h"
#include "util/strtod.h"
+#include "gen7_pack.h"
+
struct anv_dispatch_table dtable;
static void
diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c
index 942e7cfb484..a231967a865 100644
--- a/src/vulkan/anv_formats.c
+++ b/src/vulkan/anv_formats.c
@@ -24,6 +24,8 @@
#include "anv_private.h"
#include "brw_surface_formats.h"
+#include "gen7_pack.h"
+
#define fmt(__vk_fmt, __hw_fmt, ...) \
[__vk_fmt] = { \
.vk_format = __vk_fmt, \
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c
index e90257e8faa..7808454262e 100644
--- a/src/vulkan/anv_image.c
+++ b/src/vulkan/anv_image.c
@@ -29,6 +29,11 @@
#include "anv_private.h"
+/* FIXME: We shouldn't be using the actual hardware enum values here. They
+ * change across gens. Once we get that fixed, this include needs to go.
+ */
+#include "gen8_pack.h"
+
static const uint8_t anv_halign[] = {
[4] = HALIGN4,
[8] = HALIGN8,
diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c
index a9cf16f79c2..6c9deaddda7 100644
--- a/src/vulkan/anv_pipeline.c
+++ b/src/vulkan/anv_pipeline.c
@@ -260,7 +260,7 @@ static const uint32_t vk_to_gen_primitive_type[] = {
[VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ] = _3DPRIM_LINESTRIP_ADJ,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ] = _3DPRIM_TRILIST_ADJ,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ] = _3DPRIM_TRISTRIP_ADJ,
- [VK_PRIMITIVE_TOPOLOGY_PATCH] = _3DPRIM_PATCHLIST_1
+/* [VK_PRIMITIVE_TOPOLOGY_PATCH] = _3DPRIM_PATCHLIST_1 */
};
static void
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index 5afd42b4d13..a8ed5e8a7e2 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -627,11 +627,6 @@ __gen_combine_address(struct anv_batch *batch, void *location,
}
}
-#include "gen7_pack.h"
-#include "gen75_pack.h"
-#undef GEN8_3DSTATE_MULTISAMPLE
-#include "gen8_pack.h"
-
#define anv_batch_emit(batch, cmd, ...) do { \
void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \
struct cmd __template = { \
@@ -664,11 +659,11 @@ __gen_combine_address(struct anv_batch *batch, void *location,
VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\
} while (0)
-static const struct GEN7_MEMORY_OBJECT_CONTROL_STATE GEN7_MOCS = {
- .GraphicsDataTypeGFDT = 0,
- .LLCCacheabilityControlLLCCC = 0,
- .L3CacheabilityControlL3CC = 1
-};
+#define GEN7_MOCS (struct GEN7_MEMORY_OBJECT_CONTROL_STATE) { \
+ .GraphicsDataTypeGFDT = 0, \
+ .LLCCacheabilityControlLLCCC = 0, \
+ .L3CacheabilityControlL3CC = 1, \
+}
#define GEN8_MOCS { \
.MemoryTypeLLCeLLCCacheabilityControl = WB, \
@@ -923,7 +918,7 @@ struct anv_cmd_state {
struct anv_framebuffer * framebuffer;
struct anv_render_pass * pass;
struct anv_subpass * subpass;
- uint32_t state_vf[GEN8_3DSTATE_VF_length];
+ uint32_t state_vf[2];
struct anv_vertex_binding vertex_bindings[MAX_VBS];
struct anv_descriptor_set * descriptors[MAX_SETS];
struct anv_push_constants * push_constants[VK_SHADER_STAGE_NUM];
@@ -1150,15 +1145,15 @@ struct anv_pipeline {
uint32_t cs_right_mask;
struct {
- uint32_t sf[GEN7_3DSTATE_SF_length];
- uint32_t depth_stencil_state[GEN7_DEPTH_STENCIL_STATE_length];
+ uint32_t sf[7];
+ uint32_t depth_stencil_state[3];
} gen7;
struct {
- uint32_t sf[GEN8_3DSTATE_SF_length];
- uint32_t vf[GEN8_3DSTATE_VF_length];
- uint32_t raster[GEN8_3DSTATE_RASTER_length];
- uint32_t wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length];
+ uint32_t sf[4];
+ uint32_t vf[2];
+ uint32_t raster[5];
+ uint32_t wm_depth_stencil[3];
} gen8;
};
diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c
index ee40a0de09c..4f5d50fe167 100644
--- a/src/vulkan/gen7_cmd_buffer.c
+++ b/src/vulkan/gen7_cmd_buffer.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen7_pack.h"
+
static void
gen7_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
{
@@ -283,7 +285,7 @@ emit_scissor_state(struct anv_cmd_buffer *cmd_buffer,
}
}
- anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_SCISSOR_STATE_POINTERS,
+ anv_batch_emit(&cmd_buffer->batch, GEN7_3DSTATE_SCISSOR_STATE_POINTERS,
.ScissorRectPointer = scissor_state.offset);
}
diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c
index 1fed33a53d1..d53489c2db1 100644
--- a/src/vulkan/gen7_pipeline.c
+++ b/src/vulkan/gen7_pipeline.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen7_pack.h"
+
static void
gen7_emit_vertex_input(struct anv_pipeline *pipeline,
const VkPipelineVertexInputStateCreateInfo *info)
@@ -92,8 +94,8 @@ static const uint32_t vk_to_gen_fillmode[] = {
};
static const uint32_t vk_to_gen_front_face[] = {
- [VK_FRONT_FACE_CCW] = CounterClockwise,
- [VK_FRONT_FACE_CW] = Clockwise
+ [VK_FRONT_FACE_CCW] = 1,
+ [VK_FRONT_FACE_CW] = 0
};
static void
@@ -575,9 +577,9 @@ gen7_graphics_pipeline_create(
anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_WM,
.StatisticsEnable = true,
.ThreadDispatchEnable = true,
- .LineEndCapAntialiasingRegionWidth = _05pixels,
- .LineAntialiasingRegionWidth = _10pixels,
- .EarlyDepthStencilControl = NORMAL,
+ .LineEndCapAntialiasingRegionWidth = 0, /* 0.5 pixels */
+ .LineAntialiasingRegionWidth = 1, /* 1.0 pixels */
+ .EarlyDepthStencilControl = EDSC_NORMAL,
.PointRasterizationRule = RASTRULE_UPPER_RIGHT,
.PixelShaderComputedDepthMode = wm_prog_data->computed_depth_mode,
.BarycentricInterpolationMode = wm_prog_data->barycentric_interp_modes);
diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c
index a53b6e3faf3..596e232ab6f 100644
--- a/src/vulkan/gen7_state.c
+++ b/src/vulkan/gen7_state.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen7_pack.h"
+
void
gen7_fill_buffer_surface_state(void *state, const struct anv_format *format,
uint32_t offset, uint32_t range, uint32_t stride)
@@ -272,7 +274,7 @@ gen7_image_view_init(struct anv_image_view *iview,
iview->color_rt_surface_state =
gen7_alloc_surface_state(device, cmd_buffer);
- surface_state.RenderCacheReadWriteMode = WriteOnlyCache;
+ surface_state.RenderCacheReadWriteMode = 0; /* Write only */
/* For render target surfaces, the hardware interprets field MIPCount/LOD as
* LOD. The Broadwell PRM says:
diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c
index 2c76e31936f..2e4a618bad1 100644
--- a/src/vulkan/gen8_cmd_buffer.c
+++ b/src/vulkan/gen8_cmd_buffer.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen8_pack.h"
+
static void
gen8_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
{
@@ -94,14 +96,14 @@ emit_viewport_state(struct anv_cmd_buffer *cmd_buffer,
.YMaxViewPort = vp->originY + vp->height - 1,
};
- struct GEN7_CC_VIEWPORT cc_viewport = {
+ struct GEN8_CC_VIEWPORT cc_viewport = {
.MinimumDepth = vp->minDepth,
.MaximumDepth = vp->maxDepth
};
GEN8_SF_CLIP_VIEWPORT_pack(NULL, sf_clip_state.map + i * 64,
&sf_clip_viewport);
- GEN7_CC_VIEWPORT_pack(NULL, cc_state.map + i * 32, &cc_viewport);
+ GEN8_CC_VIEWPORT_pack(NULL, cc_state.map + i * 32, &cc_viewport);
}
anv_batch_emit(&cmd_buffer->batch,
diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c
index e98045248a4..81bc254b3f7 100644
--- a/src/vulkan/gen8_pipeline.c
+++ b/src/vulkan/gen8_pipeline.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen8_pack.h"
+
static void
emit_vertex_input(struct anv_pipeline *pipeline,
const VkPipelineVertexInputStateCreateInfo *info)
diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c
index 6eb65e6ec4e..94972d20490 100644
--- a/src/vulkan/gen8_state.c
+++ b/src/vulkan/gen8_state.c
@@ -29,6 +29,8 @@
#include "anv_private.h"
+#include "gen8_pack.h"
+
void
gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
uint32_t offset, uint32_t range, uint32_t stride)