summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-05-28 12:02:56 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-05-28 23:16:31 +0100
commitb3169768ddf8c8977d2ace3675611b5ec6eba7ee (patch)
tree2cfb0f16f819a62d0af95004b072d835f59353ee /src
parent0839e3316a02380cd64d354ee0ec9d4c2b8eecf4 (diff)
sna: Make the backend identifier more informative
This is useful, for example, with the multiple gen7 variants. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen2_render.c4
-rw-r--r--src/sna/gen3_render.c4
-rw-r--r--src/sna/gen4_render.c6
-rw-r--r--src/sna/gen5_render.c6
-rw-r--r--src/sna/gen6_render.c6
-rw-r--r--src/sna/gen7_render.c21
-rw-r--r--src/sna/sna_accel.c37
-rw-r--r--src/sna/sna_render.c3
-rw-r--r--src/sna/sna_render.h15
9 files changed, 51 insertions, 51 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index 58f2578a..f09a20b3 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -3436,7 +3436,7 @@ gen2_render_context_switch(struct kgem *kgem,
}
}
-bool gen2_render_init(struct sna *sna)
+const char *gen2_render_init(struct sna *sna, const char *backend)
{
struct sna_render *render = &sna->render;
@@ -3467,5 +3467,5 @@ bool gen2_render_init(struct sna *sna)
render->max_3d_size = MAX_3D_SIZE;
render->max_3d_pitch = MAX_3D_PITCH;
- return true;
+ return "Almador (gen2)";
}
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index c549ebb9..94cd541c 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -6204,7 +6204,7 @@ gen3_render_fini(struct sna *sna)
{
}
-bool gen3_render_init(struct sna *sna)
+const char *gen3_render_init(struct sna *sna, const char *backend)
{
struct sna_render *render = &sna->render;
@@ -6236,5 +6236,5 @@ bool gen3_render_init(struct sna *sna)
sna->kgem.retire = gen3_render_retire;
sna->kgem.expire = gen3_render_expire;
- return true;
+ return "Alviso (gen3)";
}
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 575cc6a5..e94fb6df 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -3137,10 +3137,10 @@ static bool gen4_render_setup(struct sna *sna)
return state->general_bo != NULL;
}
-bool gen4_render_init(struct sna *sna)
+const char *gen4_render_init(struct sna *sna, const char *backend)
{
if (!gen4_render_setup(sna))
- return false;
+ return backend;
sna->kgem.retire = gen4_render_retire;
sna->kgem.expire = gen4_render_expire;
@@ -3183,5 +3183,5 @@ bool gen4_render_init(struct sna *sna)
sna->render.max_3d_size = GEN4_MAX_3D_SIZE;
sna->render.max_3d_pitch = 1 << 18;
- return true;
+ return sna->kgem.gen >= 045 ? "Eaglelake (gen4.5)" : "Broadwater (gen4)";
}
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index b960ed69..2de7eb82 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -3273,10 +3273,10 @@ static bool gen5_render_setup(struct sna *sna)
return state->general_bo != NULL;
}
-bool gen5_render_init(struct sna *sna)
+const char *gen5_render_init(struct sna *sna, const char *backend)
{
if (!gen5_render_setup(sna))
- return false;
+ return backend;
sna->kgem.context_switch = gen5_render_context_switch;
sna->kgem.retire = gen5_render_retire;
@@ -3307,5 +3307,5 @@ bool gen5_render_init(struct sna *sna)
sna->render.max_3d_size = MAX_3D_SIZE;
sna->render.max_3d_pitch = 1 << 18;
- return true;
+ return "Ironlake (gen5)";
}
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index f7af54e0..c25ef94c 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -3656,10 +3656,10 @@ static bool gen6_render_setup(struct sna *sna)
return state->general_bo != NULL;
}
-bool gen6_render_init(struct sna *sna)
+const char *gen6_render_init(struct sna *sna, const char *backend)
{
if (!gen6_render_setup(sna))
- return false;
+ return backend;
sna->kgem.context_switch = gen6_render_context_switch;
sna->kgem.retire = gen6_render_retire;
@@ -3704,5 +3704,5 @@ bool gen6_render_init(struct sna *sna)
sna->render.max_3d_size = GEN6_MAX_SIZE;
sna->render.max_3d_pitch = 1 << 18;
- return true;
+ return "Sandybridge (gen6)";
}
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 5cbed9d1..6dbf1d28 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -3718,12 +3718,13 @@ static bool is_mobile(struct sna *sna)
return (DEVICE_ID(sna->PciInfo) & 0xf) == 0x6;
}
-static bool gen7_render_setup(struct sna *sna)
+static const char *gen7_render_setup(struct sna *sna)
{
struct gen7_render_state *state = &sna->render_state.gen7;
struct sna_static_stream general;
struct gen7_sampler_state *ss;
int i, j, k, l, m;
+ const char *backend;
if (sna->kgem.gen == 070) {
state->info = &ivb_gt_info;
@@ -3732,8 +3733,10 @@ static bool gen7_render_setup(struct sna *sna)
if (is_gt2(sna))
state->info = &ivb_gt2_info; /* XXX requires GT_MODE WiZ disabled */
}
+ backend = "Ivybridge (gen7)";
} else if (sna->kgem.gen == 071) {
state->info = &ivb_gt_info;
+ backend = "Valleyview (gen7)";
} else if (sna->kgem.gen == 075) {
state->info = &hsw_gt_info;
if (DEVICE_ID(sna->PciInfo) & 0xf) {
@@ -3741,8 +3744,9 @@ static bool gen7_render_setup(struct sna *sna)
if (is_gt2(sna))
state->info = &hsw_gt2_info;
}
+ backend = "Haswell (gen7.5)";
} else
- return false;
+ return NULL;
sna_static_stream_init(&general);
@@ -3803,13 +3807,16 @@ static bool gen7_render_setup(struct sna *sna)
state->cc_blend = gen7_composite_create_blend_state(&general);
state->general_bo = sna_static_stream_fini(sna, &general);
- return state->general_bo != NULL;
+ return state->general_bo ? backend : NULL;
}
-bool gen7_render_init(struct sna *sna)
+const char *gen7_render_init(struct sna *sna, const char *parent)
{
- if (!gen7_render_setup(sna))
- return false;
+ const char *backend;
+
+ backend = gen7_render_setup(sna);
+ if (backend == NULL)
+ return parent;
sna->kgem.context_switch = gen7_render_context_switch;
sna->kgem.retire = gen7_render_retire;
@@ -3853,5 +3860,5 @@ bool gen7_render_init(struct sna *sna)
sna->render.max_3d_size = GEN7_MAX_SIZE;
sna->render.max_3d_pitch = 1 << 18;
- return true;
+ return backend;
}
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index d8e2746a..3e3e75c1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -14672,29 +14672,22 @@ bool sna_accel_init(ScreenPtr screen, struct sna *sna)
if (!sna_picture_init(screen))
return false;
- backend = "generic";
- no_render_init(sna);
+ backend = no_render_init(sna);
+ if (sna_option_accel_blt(sna) || sna->info->gen >= 0100)
+ (void)backend;
+ else if (sna->info->gen >= 070)
+ backend = gen7_render_init(sna, backend);
+ else if (sna->info->gen >= 060)
+ backend = gen6_render_init(sna, backend);
+ else if (sna->info->gen >= 050)
+ backend = gen5_render_init(sna, backend);
+ else if (sna->info->gen >= 040)
+ backend = gen4_render_init(sna, backend);
+ else if (sna->info->gen >= 030)
+ backend = gen3_render_init(sna, backend);
+ else if (sna->info->gen >= 020)
+ backend = gen2_render_init(sna, backend);
- if (sna_option_accel_blt(sna) || sna->info->gen >= 0100) {
- } else if (sna->info->gen >= 070) {
- if (gen7_render_init(sna))
- backend = "IvyBridge";
- } else if (sna->info->gen >= 060) {
- if (gen6_render_init(sna))
- backend = "SandyBridge";
- } else if (sna->info->gen >= 050) {
- if (gen5_render_init(sna))
- backend = "Ironlake";
- } else if (sna->info->gen >= 040) {
- if (gen4_render_init(sna))
- backend = "Broadwater/Crestline";
- } else if (sna->info->gen >= 030) {
- if (gen3_render_init(sna))
- backend = "gen3";
- } else if (sna->info->gen >= 020) {
- if (gen2_render_init(sna))
- backend = "gen2";
- }
DBG(("%s(backend=%s, prefer_gpu=%x)\n",
__FUNCTION__, backend, sna->render.prefer_gpu));
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index c19a2835..6e95e554 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -282,7 +282,7 @@ no_render_fini(struct sna *sna)
(void)sna;
}
-void no_render_init(struct sna *sna)
+const char *no_render_init(struct sna *sna)
{
struct sna_render *render = &sna->render;
@@ -315,6 +315,7 @@ void no_render_init(struct sna *sna)
sna->kgem.ring = KGEM_BLT;
sna_vertex_init(sna);
+ return "generic";
}
static struct kgem_bo *
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index 1a15b70e..d4406c3b 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -541,14 +541,13 @@ bool sna_get_rgba_from_pixel(uint32_t pixel,
uint32_t format);
bool sna_picture_is_solid(PicturePtr picture, uint32_t *color);
-void no_render_init(struct sna *sna);
-
-bool gen2_render_init(struct sna *sna);
-bool gen3_render_init(struct sna *sna);
-bool gen4_render_init(struct sna *sna);
-bool gen5_render_init(struct sna *sna);
-bool gen6_render_init(struct sna *sna);
-bool gen7_render_init(struct sna *sna);
+const char *no_render_init(struct sna *sna);
+const char *gen2_render_init(struct sna *sna, const char *backend);
+const char *gen3_render_init(struct sna *sna, const char *backend);
+const char *gen4_render_init(struct sna *sna, const char *backend);
+const char *gen5_render_init(struct sna *sna, const char *backend);
+const char *gen6_render_init(struct sna *sna, const char *backend);
+const char *gen7_render_init(struct sna *sna, const char *backend);
bool sna_tiling_composite(uint32_t op,
PicturePtr src,