summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-25 22:21:29 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-03 12:26:12 +0100
commit5ff749727d3590368806508ac0d0fa8efd1d1d51 (patch)
treecfcd1c54f88f24a15cd2605522a545f104e14591 /src
parentcd028cad3dc9b059a3d83b818d581f86e16ec317 (diff)
sna/gen7: Add constant variations and hookup a basic GT descriptor for Haswell
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen7_render.c30
-rw-r--r--src/sna/gen7_render.h15
2 files changed, 37 insertions, 8 deletions
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 193de001..b4a92235 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -83,20 +83,29 @@ struct gt_info {
} urb;
};
-static const struct gt_info gt1_info = {
+static const struct gt_info ivb_gt1_info = {
.max_vs_threads = 36,
.max_gs_threads = 36,
- .max_wm_threads = (48-1) << GEN7_PS_MAX_THREADS_SHIFT,
+ .max_wm_threads = (48-1) << IVB_PS_MAX_THREADS_SHIFT,
.urb = { 128, 512, 192 },
};
-static const struct gt_info gt2_info = {
+static const struct gt_info ivb_gt2_info = {
.max_vs_threads = 128,
.max_gs_threads = 128,
- .max_wm_threads = (172-1) << GEN7_PS_MAX_THREADS_SHIFT,
+ .max_wm_threads = (172-1) << IVB_PS_MAX_THREADS_SHIFT,
.urb = { 256, 704, 320 },
};
+static const struct gt_info hsw_gt_info = {
+ .max_vs_threads = 8,
+ .max_gs_threads = 8,
+ .max_wm_threads =
+ (8 - 1) << HSW_PS_MAX_THREADS_SHIFT |
+ 1 << HSW_PS_SAMPLE_MASK_SHIFT,
+ .urb = { 128, 64, 64 },
+};
+
static const uint32_t ps_kernel_packed[][4] = {
#include "exa_wm_src_affine.g7b"
#include "exa_wm_src_sample_argb.g7b"
@@ -1363,6 +1372,8 @@ gen7_bind_bo(struct sna *sna,
ss[5] = 0;
ss[6] = 0;
ss[7] = 0;
+ if (sna->kgem.gen == 75)
+ ss[7] |= HSW_SURFACE_SWIZZLE(RED, GREEN, BLUE, ALPHA);
kgem_bo_set_binding(bo, format, offset);
@@ -4234,9 +4245,14 @@ static bool gen7_render_setup(struct sna *sna)
struct gen7_sampler_state *ss;
int i, j, k, l, m;
- state->info = &gt1_info;
- if (DEVICE_ID(sna->PciInfo) & 0x20)
- state->info = &gt2_info; /* XXX requires GT_MODE WiZ disabled */
+ if (sna->kgem.gen == 70) {
+ state->info = &ivb_gt1_info;
+ if (DEVICE_ID(sna->PciInfo) & 0x20)
+ state->info = &ivb_gt2_info; /* XXX requires GT_MODE WiZ disabled */
+ } else if (sna->kgem.gen == 75) {
+ state->info = &hsw_gt_info;
+ } else
+ return false;
sna_static_stream_init(&general);
diff --git a/src/sna/gen7_render.h b/src/sna/gen7_render.h
index 8de52a44..1661d4c4 100644
--- a/src/sna/gen7_render.h
+++ b/src/sna/gen7_render.h
@@ -1237,6 +1237,17 @@ struct gen7_sampler_state {
#define GEN7_SURFACE_DEPTH_SHIFT 21
#define GEN7_SURFACE_PITCH_SHIFT 0
+#define HSW_SWIZZLE_ZERO 0
+#define HSW_SWIZZLE_ONE 1
+#define HSW_SWIZZLE_RED 4
+#define HSW_SWIZZLE_GREEN 5
+#define HSW_SWIZZLE_BLUE 6
+#define HSW_SWIZZLE_ALPHA 7
+#define __HSW_SURFACE_SWIZZLE(r,g,b,a) \
+ ((a) << 16 | (b) << 19 | (g) << 22 | (r) << 25)
+#define HSW_SURFACE_SWIZZLE(r,g,b,a) \
+ __HSW_SURFACE_SWIZZLE(HSW_SWIZZLE_##r, HSW_SWIZZLE_##g, HSW_SWIZZLE_##b, HSW_SWIZZLE_##a)
+
/* _3DSTATE_VERTEX_BUFFERS on GEN7*/
/* DW1 */
#define GEN7_VB0_ADDRESS_MODIFYENABLE (1 << 14)
@@ -1281,7 +1292,9 @@ struct gen7_sampler_state {
# define GEN7_PS_FLOATING_POINT_MODE_ALT (1 << 16)
/* DW3: scratch space */
/* DW4 */
-# define GEN7_PS_MAX_THREADS_SHIFT 24
+# define IVB_PS_MAX_THREADS_SHIFT 24
+# define HSW_PS_MAX_THREADS_SHIFT 23
+# define HSW_PS_SAMPLE_MASK_SHIFT 12
# define GEN7_PS_PUSH_CONSTANT_ENABLE (1 << 11)
# define GEN7_PS_ATTRIBUTE_ENABLE (1 << 10)
# define GEN7_PS_OMASK_TO_RENDER_TARGET (1 << 9)