aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/core
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2015-06-12 14:47:02 +0800
committerChia-I Wu <[email protected]>2015-06-15 01:07:10 +0800
commit30fcb31c9b095451ce5ac5a10c3c6b177dc03e20 (patch)
tree9e34d182e3848674f1ac85d9f97b3b3fe23a4b13 /src/gallium/drivers/ilo/core
parentda6e45fcbc4570df0ec4b8c8885f33a206da3552 (diff)
ilo: add ilo_state_{vs,hs,ds,gs} to ilo_shader_cso
Diffstat (limited to 'src/gallium/drivers/ilo/core')
-rw-r--r--src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h34
-rw-r--r--src/gallium/drivers/ilo/core/ilo_builder_3d_top.h278
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d.h25
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c38
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_top.c251
5 files changed, 160 insertions, 466 deletions
diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
index fc63c80c2ce..68461fff09d 100644
--- a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
+++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
@@ -217,14 +217,14 @@ gen6_3DSTATE_WM(struct ilo_builder *builder,
dw6 = rs->raster[2];
if (fs) {
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
cso = ilo_shader_get_kernel_cso(fs);
/* see fs_init_cso_gen6() */
- dw2 |= cso->payload[0];
- dw4 |= cso->payload[1];
- dw5 |= cso->payload[2];
- dw6 |= cso->payload[3];
+ dw2 |= cso->ps_payload[0];
+ dw4 |= cso->ps_payload[1];
+ dw5 |= cso->ps_payload[2];
+ dw6 |= cso->ps_payload[3];
} else {
const int max_threads = (builder->dev->gt == 2) ? 80 : 40;
@@ -271,11 +271,11 @@ gen7_3DSTATE_WM(struct ilo_builder *builder,
dw1 = rs->wm[0];
if (fs) {
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
cso = ilo_shader_get_kernel_cso(fs);
/* see fs_init_cso_gen7() */
- dw1 |= cso->payload[3];
+ dw1 |= cso->ps_payload[3];
}
if (cc_may_kill)
@@ -383,16 +383,16 @@ gen7_3DSTATE_PS(struct ilo_builder *builder,
bool dual_blend)
{
const uint8_t cmd_len = 8;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw2, dw4, dw5, *dw;
ILO_DEV_ASSERT(builder->dev, 7, 7.5);
/* see fs_init_cso_gen7() */
cso = ilo_shader_get_kernel_cso(fs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
+ dw2 = cso->ps_payload[0];
+ dw4 = cso->ps_payload[1];
+ dw5 = cso->ps_payload[2];
if (dual_blend)
dw4 |= GEN7_PS_DW4_DUAL_SOURCE_BLEND;
@@ -452,16 +452,16 @@ gen8_3DSTATE_PS(struct ilo_builder *builder,
const struct ilo_shader_state *fs)
{
const uint8_t cmd_len = 12;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw3, dw6, dw7, *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
/* see fs_init_cso_gen8() */
cso = ilo_shader_get_kernel_cso(fs);
- dw3 = cso->payload[0];
- dw6 = cso->payload[1];
- dw7 = cso->payload[2];
+ dw3 = cso->ps_payload[0];
+ dw6 = cso->ps_payload[1];
+ dw7 = cso->ps_payload[2];
ilo_builder_batch_pointer(builder, cmd_len, &dw);
@@ -485,14 +485,14 @@ gen8_3DSTATE_PS_EXTRA(struct ilo_builder *builder,
bool cc_may_kill, bool per_sample)
{
const uint8_t cmd_len = 2;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw1, *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
/* see fs_init_cso_gen8() */
cso = ilo_shader_get_kernel_cso(fs);
- dw1 = cso->payload[3];
+ dw1 = cso->ps_payload[3];
if (cc_may_kill)
dw1 |= GEN8_PSX_DW1_VALID | GEN8_PSX_DW1_KILL_PIXEL;
diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
index a47c2973480..85b0da7406d 100644
--- a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
+++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
@@ -30,13 +30,13 @@
#include "genhw/genhw.h"
#include "../ilo_resource.h"
-#include "../ilo_shader.h"
#include "intel_winsys.h"
#include "ilo_core.h"
#include "ilo_dev.h"
#include "ilo_state_3d.h"
#include "ilo_state_sampler.h"
+#include "ilo_state_shader.h"
#include "ilo_state_sol.h"
#include "ilo_state_urb.h"
#include "ilo_state_vf.h"
@@ -546,102 +546,98 @@ gen8_3DSTATE_INDEX_BUFFER(struct ilo_builder *builder,
static inline void
gen6_3DSTATE_VS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs)
+ const struct ilo_state_vs *vs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 6;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 6, 7.5);
- cso = ilo_shader_get_kernel_cso(vs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
+ dw[1] = kernel_offset;
+ /* see vs_set_gen6_3DSTATE_VS() */
+ dw[2] = vs->vs[0];
+ dw[3] = vs->vs[1];
+ dw[4] = vs->vs[2];
+ dw[5] = vs->vs[3];
}
static inline void
gen8_3DSTATE_VS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs,
- uint32_t clip_plane_enable)
+ const struct ilo_state_vs *vs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 9;
- const struct ilo_shader_cso *cso;
- uint32_t dw3, dw6, dw7, dw8, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
- cso = ilo_shader_get_kernel_cso(vs);
- dw3 = cso->payload[0];
- dw6 = cso->payload[1];
- dw7 = cso->payload[2];
- dw8 = clip_plane_enable << GEN8_VS_DW8_UCP_CLIP_ENABLES__SHIFT;
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs);
+ dw[1] = kernel_offset;
dw[2] = 0;
- dw[3] = dw3;
- dw[4] = 0; /* scratch */
+ /* see vs_set_gen6_3DSTATE_VS() */
+ dw[3] = vs->vs[0];
+ dw[4] = vs->vs[1];
dw[5] = 0;
- dw[6] = dw6;
- dw[7] = dw7;
- dw[8] = dw8;
+ dw[6] = vs->vs[2];
+ dw[7] = vs->vs[3];
+ dw[8] = vs->vs[4];
}
static inline void
-gen6_disable_3DSTATE_VS(struct ilo_builder *builder)
+gen7_3DSTATE_HS(struct ilo_builder *builder,
+ const struct ilo_state_hs *hs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = 6;
+ const uint8_t cmd_len = 7;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 6, 7.5);
+ ILO_DEV_ASSERT(builder->dev, 7, 7.5);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
- dw[5] = 0;
+ dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_HS) | (cmd_len - 2);
+ /* see hs_set_gen7_3DSTATE_HS() */
+ dw[1] = hs->hs[0];
+ dw[2] = hs->hs[1];
+ dw[3] = kernel_offset;
+ dw[4] = hs->hs[2];
+ dw[5] = hs->hs[3];
+ dw[6] = 0;
}
static inline void
-gen7_disable_3DSTATE_HS(struct ilo_builder *builder)
+gen8_3DSTATE_HS(struct ilo_builder *builder,
+ const struct ilo_state_hs *hs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 9 : 7;
+ const uint8_t cmd_len = 9;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_HS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
+ /* see hs_set_gen7_3DSTATE_HS() */
+ dw[1] = hs->hs[0];
+ dw[2] = hs->hs[1];
+ dw[3] = kernel_offset;
dw[4] = 0;
- dw[5] = 0;
+ dw[5] = hs->hs[2];
dw[6] = 0;
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[7] = 0;
- dw[8] = 0;
- }
+ dw[7] = hs->hs[3];
+ dw[8] = 0;
}
static inline void
-gen7_3DSTATE_TE(struct ilo_builder *builder)
+gen7_3DSTATE_TE(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds)
{
const uint8_t cmd_len = 4;
uint32_t *dw;
@@ -651,108 +647,61 @@ gen7_3DSTATE_TE(struct ilo_builder *builder)
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_TE) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
+ /* see ds_set_gen7_3DSTATE_TE() */
+ dw[1] = ds->te[0];
+ dw[2] = ds->te[1];
+ dw[3] = ds->te[2];
}
static inline void
-gen7_disable_3DSTATE_DS(struct ilo_builder *builder)
+gen7_3DSTATE_DS(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 9 : 6;
+ const uint8_t cmd_len = 6;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 7, 7.5);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_DS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
- dw[5] = 0;
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[6] = 0;
- dw[7] = 0;
- dw[8] = 0;
- }
+ /* see ds_set_gen7_3DSTATE_DS() */
+ dw[1] = kernel_offset;
+ dw[2] = ds->ds[0];
+ dw[3] = ds->ds[1];
+ dw[4] = ds->ds[2];
+ dw[5] = ds->ds[3];
}
static inline void
-gen6_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *gs)
+gen8_3DSTATE_DS(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = 7;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, dw6, *dw;
-
- ILO_DEV_ASSERT(builder->dev, 6, 6);
-
- cso = ilo_shader_get_kernel_cso(gs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
- dw6 = cso->payload[3];
-
- ilo_builder_batch_pointer(builder, cmd_len, &dw);
-
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(gs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
- dw[6] = dw6;
-}
-
-static inline void
-gen6_so_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs,
- int verts_per_prim)
-{
- const uint8_t cmd_len = 7;
- struct ilo_shader_cso cso;
- enum ilo_kernel_param param;
- uint32_t dw2, dw4, dw5, dw6, *dw;
-
- ILO_DEV_ASSERT(builder->dev, 6, 6);
-
- assert(ilo_shader_get_kernel_param(vs, ILO_KERNEL_VS_GEN6_SO));
-
- switch (verts_per_prim) {
- case 1:
- param = ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET;
- break;
- case 2:
- param = ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET;
- break;
- default:
- param = ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET;
- break;
- }
+ const uint8_t cmd_len = 9;
+ uint32_t *dw;
- /* cannot use VS's CSO */
- ilo_gpe_init_gs_cso(builder->dev, vs, &cso);
- dw2 = cso.payload[0];
- dw4 = cso.payload[1];
- dw5 = cso.payload[2];
- dw6 = cso.payload[3];
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs) +
- ilo_shader_get_kernel_param(vs, param);
- dw[2] = dw2;
- dw[3] = 0;
- dw[4] = dw4;
- dw[5] = dw5;
- dw[6] = dw6;
+ dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_DS) | (cmd_len - 2);
+ /* see ds_set_gen7_3DSTATE_DS() */
+ dw[1] = kernel_offset;
+ dw[2] = 0;
+ dw[3] = ds->ds[0];
+ dw[4] = ds->ds[1];
+ dw[5] = 0;
+ dw[6] = ds->ds[2];
+ dw[7] = ds->ds[3];
+ dw[8] = ds->ds[4];
}
static inline void
-gen6_disable_3DSTATE_GS(struct ilo_builder *builder)
+gen6_3DSTATE_GS(struct ilo_builder *builder,
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 7;
uint32_t *dw;
@@ -762,13 +711,13 @@ gen6_disable_3DSTATE_GS(struct ilo_builder *builder)
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- /* honor the valid range of URB read length */
- dw[4] = 1 << GEN6_GS_DW4_URB_READ_LEN__SHIFT;
- dw[5] = GEN6_GS_DW5_STATISTICS;
- dw[6] = 0;
+ dw[1] = kernel_offset;
+ /* see gs_set_gen6_3DSTATE_GS() */
+ dw[2] = gs->gs[0];
+ dw[3] = gs->gs[1];
+ dw[4] = gs->gs[2];
+ dw[5] = gs->gs[3];
+ dw[6] = gs->gs[4];
}
static inline void
@@ -797,54 +746,49 @@ gen6_3DSTATE_GS_SVB_INDEX(struct ilo_builder *builder,
static inline void
gen7_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *gs)
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 7;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 7, 7.5);
- cso = ilo_shader_get_kernel_cso(gs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(gs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
+ dw[1] = kernel_offset;
+ /* see gs_set_gen7_3DSTATE_GS() */
+ dw[2] = gs->gs[0];
+ dw[3] = gs->gs[1];
+ dw[4] = gs->gs[2];
+ dw[5] = gs->gs[3];
dw[6] = 0;
}
static inline void
-gen7_disable_3DSTATE_GS(struct ilo_builder *builder)
+gen8_3DSTATE_GS(struct ilo_builder *builder,
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 10 : 7;
+ const uint8_t cmd_len = 10;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = 0;
+ dw[1] = kernel_offset;
dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
-
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[7] = GEN8_GS_DW7_STATISTICS;
- dw[8] = 0;
- dw[9] = 0;
- } else {
- dw[5] = GEN7_GS_DW5_STATISTICS;
- dw[6] = 0;
- }
+ /* see gs_set_gen7_3DSTATE_GS() */
+ dw[3] = gs->gs[0];
+ dw[4] = gs->gs[1];
+ dw[5] = 0;
+ dw[6] = gs->gs[2];
+ dw[7] = gs->gs[3];
+ dw[8] = 0;
+ dw[9] = gs->gs[4];
}
static inline void
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d.h b/src/gallium/drivers/ilo/core/ilo_state_3d.h
index 16db93c6603..b2087df3470 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d.h
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d.h
@@ -33,6 +33,7 @@
#include "ilo_core.h"
#include "ilo_dev.h"
+#include "ilo_state_shader.h"
#include "ilo_state_surface.h"
#include "ilo_state_zs.h"
@@ -113,24 +114,24 @@ struct ilo_fb_state {
enum gen_depth_format depth_offset_format;
};
-struct ilo_shader_cso {
- uint32_t payload[5];
-};
+union ilo_shader_cso {
+ struct ilo_state_vs vs;
+ struct ilo_state_hs hs;
+ struct ilo_state_ds ds;
+ struct ilo_state_gs gs;
-void
-ilo_gpe_init_vs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *vs,
- struct ilo_shader_cso *cso);
+ uint32_t ps_payload[5];
-void
-ilo_gpe_init_gs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso);
+ struct {
+ struct ilo_state_vs vs;
+ struct ilo_state_gs sol;
+ } vs_sol;
+};
void
ilo_gpe_init_fs_cso(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso);
+ union ilo_shader_cso *cso);
void
ilo_gpe_set_fb(const struct ilo_dev *dev,
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
index 932b80dd0aa..004904fcd08 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
@@ -37,7 +37,7 @@
static void
fs_init_cso_gen6(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, input_count, sampler_count, max_threads;
uint32_t dw2, dw4, dw5, dw6;
@@ -121,11 +121,11 @@ fs_init_cso_gen6(const struct ilo_dev *dev,
dw6 = input_count << GEN6_WM_DW6_SF_ATTR_COUNT__SHIFT |
GEN6_POSOFFSET_NONE << GEN6_WM_DW6_PS_POSOFFSET__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = dw6;
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw2;
+ cso->ps_payload[1] = dw4;
+ cso->ps_payload[2] = dw5;
+ cso->ps_payload[3] = dw6;
}
static uint32_t
@@ -191,7 +191,7 @@ fs_get_wm_gen7(const struct ilo_dev *dev,
static void
fs_init_cso_gen7(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, sampler_count, max_threads;
uint32_t dw2, dw4, dw5;
@@ -233,11 +233,11 @@ fs_init_cso_gen7(const struct ilo_dev *dev,
0 << GEN7_PS_DW5_URB_GRF_START1__SHIFT |
0 << GEN7_PS_DW5_URB_GRF_START2__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = fs_get_wm_gen7(dev, fs);
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw2;
+ cso->ps_payload[1] = dw4;
+ cso->ps_payload[2] = dw5;
+ cso->ps_payload[3] = fs_get_wm_gen7(dev, fs);
}
static uint32_t
@@ -267,7 +267,7 @@ fs_get_psx_gen8(const struct ilo_dev *dev,
static void
fs_init_cso_gen8(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, sampler_count;
uint32_t dw3, dw6, dw7;
@@ -293,17 +293,17 @@ fs_init_cso_gen8(const struct ilo_dev *dev,
0 << GEN8_PS_DW7_URB_GRF_START1__SHIFT |
0 << GEN8_PS_DW7_URB_GRF_START2__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw3;
- cso->payload[1] = dw6;
- cso->payload[2] = dw7;
- cso->payload[3] = fs_get_psx_gen8(dev, fs);
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw3;
+ cso->ps_payload[1] = dw6;
+ cso->ps_payload[2] = dw7;
+ cso->ps_payload[3] = fs_get_psx_gen8(dev, fs);
}
void
ilo_gpe_init_fs_cso(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
if (ilo_dev_gen(dev) >= ILO_GEN(8))
fs_init_cso_gen8(dev, fs, cso);
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
deleted file mode 100644
index feac579f2de..00000000000
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2012-2014 LunarG, Inc.
- *
- * 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 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.
- *
- * Authors:
- * Chia-I Wu <[email protected]>
- */
-
-#include "genhw/genhw.h"
-#include "util/u_dual_blend.h"
-#include "util/u_framebuffer.h"
-#include "util/u_half.h"
-#include "util/u_resource.h"
-
-#include "ilo_buffer.h"
-#include "ilo_format.h"
-#include "ilo_image.h"
-#include "ilo_state_3d.h"
-#include "../ilo_shader.h"
-
-void
-ilo_gpe_init_vs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *vs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, sampler_count, max_threads;
- uint32_t dw2, dw4, dw5;
-
- ILO_DEV_ASSERT(dev, 6, 8);
-
- start_grf = ilo_shader_get_kernel_param(vs, ILO_KERNEL_URB_DATA_START_REG);
- vue_read_len = ilo_shader_get_kernel_param(vs, ILO_KERNEL_INPUT_COUNT);
- sampler_count = ilo_shader_get_kernel_param(vs, ILO_KERNEL_SAMPLER_COUNT);
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 135:
- *
- * "(Vertex URB Entry Read Length) Specifies the number of pairs of
- * 128-bit vertex elements to be passed into the payload for each
- * vertex."
- *
- * "It is UNDEFINED to set this field to 0 indicating no Vertex URB
- * data to be read and passed to the thread."
- */
- vue_read_len = (vue_read_len + 1) / 2;
- if (!vue_read_len)
- vue_read_len = 1;
-
- max_threads = dev->thread_count;
- if (ilo_dev_gen(dev) == ILO_GEN(7.5) && dev->gt == 2)
- max_threads *= 2;
-
- dw2 = (true) ? 0 : GEN6_THREADDISP_FP_MODE_ALT;
- dw2 |= ((sampler_count + 3) / 4) << GEN6_THREADDISP_SAMPLER_COUNT__SHIFT;
-
- dw4 = start_grf << GEN6_VS_DW4_URB_GRF_START__SHIFT |
- vue_read_len << GEN6_VS_DW4_URB_READ_LEN__SHIFT |
- 0 << GEN6_VS_DW4_URB_READ_OFFSET__SHIFT;
-
- dw5 = GEN6_VS_DW5_STATISTICS |
- GEN6_VS_DW5_VS_ENABLE;
-
- if (ilo_dev_gen(dev) >= ILO_GEN(7.5))
- dw5 |= (max_threads - 1) << GEN75_VS_DW5_MAX_THREADS__SHIFT;
- else
- dw5 |= (max_threads - 1) << GEN6_VS_DW5_MAX_THREADS__SHIFT;
-
- STATIC_ASSERT(Elements(cso->payload) >= 3);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
-}
-
-static void
-gs_init_cso_gen6(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, max_threads;
- uint32_t dw2, dw4, dw5, dw6;
-
- ILO_DEV_ASSERT(dev, 6, 6);
-
- if (ilo_shader_get_type(gs) == PIPE_SHADER_GEOMETRY) {
- start_grf = ilo_shader_get_kernel_param(gs,
- ILO_KERNEL_URB_DATA_START_REG);
-
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_INPUT_COUNT);
- }
- else {
- start_grf = ilo_shader_get_kernel_param(gs,
- ILO_KERNEL_VS_GEN6_SO_START_REG);
-
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_OUTPUT_COUNT);
- }
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 153:
- *
- * "Specifies the amount of URB data read and passed in the thread
- * payload for each Vertex URB entry, in 256-bit register increments.
- *
- * It is UNDEFINED to set this field (Vertex URB Entry Read Length) to
- * 0 indicating no Vertex URB data to be read and passed to the
- * thread."
- */
- vue_read_len = (vue_read_len + 1) / 2;
- if (!vue_read_len)
- vue_read_len = 1;
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 154:
- *
- * "Maximum Number of Threads valid range is [0,27] when Rendering
- * Enabled bit is set."
- *
- * From the Sandy Bridge PRM, volume 2 part 1, page 173:
- *
- * "Programming Note: If the GS stage is enabled, software must always
- * allocate at least one GS URB Entry. This is true even if the GS
- * thread never needs to output vertices to the pipeline, e.g., when
- * only performing stream output. This is an artifact of the need to
- * pass the GS thread an initial destination URB handle."
- *
- * As such, we always enable rendering, and limit the number of threads.
- */
- if (dev->gt == 2) {
- /* maximum is 60, but limited to 28 */
- max_threads = 28;
- }
- else {
- /* maximum is 24, but limited to 21 (see brwCreateContext()) */
- max_threads = 21;
- }
-
- dw2 = GEN6_THREADDISP_SPF;
-
- dw4 = vue_read_len << GEN6_GS_DW4_URB_READ_LEN__SHIFT |
- 0 << GEN6_GS_DW4_URB_READ_OFFSET__SHIFT |
- start_grf << GEN6_GS_DW4_URB_GRF_START__SHIFT;
-
- dw5 = (max_threads - 1) << GEN6_GS_DW5_MAX_THREADS__SHIFT |
- GEN6_GS_DW5_STATISTICS |
- GEN6_GS_DW5_SO_STATISTICS |
- GEN6_GS_DW5_RENDER_ENABLE;
-
- /*
- * we cannot make use of GEN6_GS_REORDER because it will reorder
- * triangle strips according to D3D rules (triangle 2N+1 uses vertices
- * (2N+1, 2N+3, 2N+2)), instead of GL rules (triangle 2N+1 uses vertices
- * (2N+2, 2N+1, 2N+3)).
- */
- dw6 = GEN6_GS_DW6_GS_ENABLE;
-
- if (ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_DISCARD_ADJACENCY))
- dw6 |= GEN6_GS_DW6_DISCARD_ADJACENCY;
-
- if (ilo_shader_get_kernel_param(gs, ILO_KERNEL_VS_GEN6_SO)) {
- const uint32_t svbi_post_inc =
- ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_GEN6_SVBI_POST_INC);
-
- dw6 |= GEN6_GS_DW6_SVBI_PAYLOAD_ENABLE;
- if (svbi_post_inc) {
- dw6 |= GEN6_GS_DW6_SVBI_POST_INC_ENABLE |
- svbi_post_inc << GEN6_GS_DW6_SVBI_POST_INC_VAL__SHIFT;
- }
- }
-
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = dw6;
-}
-
-static void
-gs_init_cso_gen7(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, sampler_count, max_threads;
- uint32_t dw2, dw4, dw5;
-
- ILO_DEV_ASSERT(dev, 7, 7.5);
-
- start_grf = ilo_shader_get_kernel_param(gs, ILO_KERNEL_URB_DATA_START_REG);
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_INPUT_COUNT);
- sampler_count = ilo_shader_get_kernel_param(gs, ILO_KERNEL_SAMPLER_COUNT);
-
- /* in pairs */
- vue_read_len = (vue_read_len + 1) / 2;
-
- switch (ilo_dev_gen(dev)) {
- case ILO_GEN(7.5):
- max_threads = (dev->gt >= 2) ? 256 : 70;
- break;
- case ILO_GEN(7):
- max_threads = (dev->gt == 2) ? 128 : 36;
- break;
- default:
- max_threads = 1;
- break;
- }
-
- dw2 = (true) ? 0 : GEN6_THREADDISP_FP_MODE_ALT;
- dw2 |= ((sampler_count + 3) / 4) << GEN6_THREADDISP_SAMPLER_COUNT__SHIFT;
-
- dw4 = vue_read_len << GEN7_GS_DW4_URB_READ_LEN__SHIFT |
- GEN7_GS_DW4_INCLUDE_VERTEX_HANDLES |
- 0 << GEN7_GS_DW4_URB_READ_OFFSET__SHIFT |
- start_grf << GEN7_GS_DW4_URB_GRF_START__SHIFT;
-
- dw5 = (max_threads - 1) << GEN7_GS_DW5_MAX_THREADS__SHIFT |
- GEN7_GS_DW5_STATISTICS |
- GEN7_GS_DW5_GS_ENABLE;
-
- STATIC_ASSERT(Elements(cso->payload) >= 3);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
-}
-
-void
-ilo_gpe_init_gs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- if (ilo_dev_gen(dev) >= ILO_GEN(7))
- gs_init_cso_gen7(dev, gs, cso);
- else
- gs_init_cso_gen6(dev, gs, cso);
-}