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.
This commit is contained in:
@@ -29,6 +29,9 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
#include "gen8_pack.h"
|
||||||
|
|
||||||
/** \file anv_batch_chain.c
|
/** \file anv_batch_chain.c
|
||||||
*
|
*
|
||||||
* This file contains functions related to anv_cmd_buffer as a data
|
* This file contains functions related to anv_cmd_buffer as a data
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
#include "mesa/main/git_sha1.h"
|
#include "mesa/main/git_sha1.h"
|
||||||
#include "util/strtod.h"
|
#include "util/strtod.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
|
||||||
struct anv_dispatch_table dtable;
|
struct anv_dispatch_table dtable;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
#include "brw_surface_formats.h"
|
#include "brw_surface_formats.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
|
||||||
#define fmt(__vk_fmt, __hw_fmt, ...) \
|
#define fmt(__vk_fmt, __hw_fmt, ...) \
|
||||||
[__vk_fmt] = { \
|
[__vk_fmt] = { \
|
||||||
.vk_format = __vk_fmt, \
|
.vk_format = __vk_fmt, \
|
||||||
|
@@ -29,6 +29,11 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#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[] = {
|
static const uint8_t anv_halign[] = {
|
||||||
[4] = HALIGN4,
|
[4] = HALIGN4,
|
||||||
[8] = HALIGN8,
|
[8] = HALIGN8,
|
||||||
|
@@ -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_LINE_STRIP_ADJ] = _3DPRIM_LINESTRIP_ADJ,
|
||||||
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ] = _3DPRIM_TRILIST_ADJ,
|
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ] = _3DPRIM_TRILIST_ADJ,
|
||||||
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ] = _3DPRIM_TRISTRIP_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
|
static void
|
||||||
|
@@ -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 { \
|
#define anv_batch_emit(batch, cmd, ...) do { \
|
||||||
void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \
|
void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \
|
||||||
struct cmd __template = { \
|
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));\
|
VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static const struct GEN7_MEMORY_OBJECT_CONTROL_STATE GEN7_MOCS = {
|
#define GEN7_MOCS (struct GEN7_MEMORY_OBJECT_CONTROL_STATE) { \
|
||||||
.GraphicsDataTypeGFDT = 0,
|
.GraphicsDataTypeGFDT = 0, \
|
||||||
.LLCCacheabilityControlLLCCC = 0,
|
.LLCCacheabilityControlLLCCC = 0, \
|
||||||
.L3CacheabilityControlL3CC = 1
|
.L3CacheabilityControlL3CC = 1, \
|
||||||
};
|
}
|
||||||
|
|
||||||
#define GEN8_MOCS { \
|
#define GEN8_MOCS { \
|
||||||
.MemoryTypeLLCeLLCCacheabilityControl = WB, \
|
.MemoryTypeLLCeLLCCacheabilityControl = WB, \
|
||||||
@@ -923,7 +918,7 @@ struct anv_cmd_state {
|
|||||||
struct anv_framebuffer * framebuffer;
|
struct anv_framebuffer * framebuffer;
|
||||||
struct anv_render_pass * pass;
|
struct anv_render_pass * pass;
|
||||||
struct anv_subpass * subpass;
|
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_vertex_binding vertex_bindings[MAX_VBS];
|
||||||
struct anv_descriptor_set * descriptors[MAX_SETS];
|
struct anv_descriptor_set * descriptors[MAX_SETS];
|
||||||
struct anv_push_constants * push_constants[VK_SHADER_STAGE_NUM];
|
struct anv_push_constants * push_constants[VK_SHADER_STAGE_NUM];
|
||||||
@@ -1150,15 +1145,15 @@ struct anv_pipeline {
|
|||||||
uint32_t cs_right_mask;
|
uint32_t cs_right_mask;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t sf[GEN7_3DSTATE_SF_length];
|
uint32_t sf[7];
|
||||||
uint32_t depth_stencil_state[GEN7_DEPTH_STENCIL_STATE_length];
|
uint32_t depth_stencil_state[3];
|
||||||
} gen7;
|
} gen7;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t sf[GEN8_3DSTATE_SF_length];
|
uint32_t sf[4];
|
||||||
uint32_t vf[GEN8_3DSTATE_VF_length];
|
uint32_t vf[2];
|
||||||
uint32_t raster[GEN8_3DSTATE_RASTER_length];
|
uint32_t raster[5];
|
||||||
uint32_t wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length];
|
uint32_t wm_depth_stencil[3];
|
||||||
} gen8;
|
} gen8;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gen7_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
|
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);
|
.ScissorRectPointer = scissor_state.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
||||||
const VkPipelineVertexInputStateCreateInfo *info)
|
const VkPipelineVertexInputStateCreateInfo *info)
|
||||||
@@ -92,8 +94,8 @@ static const uint32_t vk_to_gen_fillmode[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t vk_to_gen_front_face[] = {
|
static const uint32_t vk_to_gen_front_face[] = {
|
||||||
[VK_FRONT_FACE_CCW] = CounterClockwise,
|
[VK_FRONT_FACE_CCW] = 1,
|
||||||
[VK_FRONT_FACE_CW] = Clockwise
|
[VK_FRONT_FACE_CW] = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -575,9 +577,9 @@ gen7_graphics_pipeline_create(
|
|||||||
anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_WM,
|
anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_WM,
|
||||||
.StatisticsEnable = true,
|
.StatisticsEnable = true,
|
||||||
.ThreadDispatchEnable = true,
|
.ThreadDispatchEnable = true,
|
||||||
.LineEndCapAntialiasingRegionWidth = _05pixels,
|
.LineEndCapAntialiasingRegionWidth = 0, /* 0.5 pixels */
|
||||||
.LineAntialiasingRegionWidth = _10pixels,
|
.LineAntialiasingRegionWidth = 1, /* 1.0 pixels */
|
||||||
.EarlyDepthStencilControl = NORMAL,
|
.EarlyDepthStencilControl = EDSC_NORMAL,
|
||||||
.PointRasterizationRule = RASTRULE_UPPER_RIGHT,
|
.PointRasterizationRule = RASTRULE_UPPER_RIGHT,
|
||||||
.PixelShaderComputedDepthMode = wm_prog_data->computed_depth_mode,
|
.PixelShaderComputedDepthMode = wm_prog_data->computed_depth_mode,
|
||||||
.BarycentricInterpolationMode = wm_prog_data->barycentric_interp_modes);
|
.BarycentricInterpolationMode = wm_prog_data->barycentric_interp_modes);
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen7_pack.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
gen7_fill_buffer_surface_state(void *state, const struct anv_format *format,
|
gen7_fill_buffer_surface_state(void *state, const struct anv_format *format,
|
||||||
uint32_t offset, uint32_t range, uint32_t stride)
|
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 =
|
iview->color_rt_surface_state =
|
||||||
gen7_alloc_surface_state(device, cmd_buffer);
|
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
|
/* For render target surfaces, the hardware interprets field MIPCount/LOD as
|
||||||
* LOD. The Broadwell PRM says:
|
* LOD. The Broadwell PRM says:
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen8_pack.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gen8_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
|
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,
|
.YMaxViewPort = vp->originY + vp->height - 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GEN7_CC_VIEWPORT cc_viewport = {
|
struct GEN8_CC_VIEWPORT cc_viewport = {
|
||||||
.MinimumDepth = vp->minDepth,
|
.MinimumDepth = vp->minDepth,
|
||||||
.MaximumDepth = vp->maxDepth
|
.MaximumDepth = vp->maxDepth
|
||||||
};
|
};
|
||||||
|
|
||||||
GEN8_SF_CLIP_VIEWPORT_pack(NULL, sf_clip_state.map + i * 64,
|
GEN8_SF_CLIP_VIEWPORT_pack(NULL, sf_clip_state.map + i * 64,
|
||||||
&sf_clip_viewport);
|
&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,
|
anv_batch_emit(&cmd_buffer->batch,
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen8_pack.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_vertex_input(struct anv_pipeline *pipeline,
|
emit_vertex_input(struct anv_pipeline *pipeline,
|
||||||
const VkPipelineVertexInputStateCreateInfo *info)
|
const VkPipelineVertexInputStateCreateInfo *info)
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
|
|
||||||
|
#include "gen8_pack.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
|
gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
|
||||||
uint32_t offset, uint32_t range, uint32_t stride)
|
uint32_t offset, uint32_t range, uint32_t stride)
|
||||||
|
Reference in New Issue
Block a user