diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-26 09:41:14 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-26 09:41:14 +0000 |
commit | 13461a18b1605feb17304d52136d100df50ca296 (patch) | |
tree | 7a51a90e4dd9eb198d4bdb93757a24e676865a40 | |
parent | 528dbf9ebb2688f476ef283be59d0f2232159dcb (diff) |
sna: Print detected CPU features
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_cpu.c | 26 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 77a52bdd..fe31b210 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -868,6 +868,7 @@ inline static bool is_clipped(const RegionRec *r, } unsigned sna_cpu_detect(void); +char *sna_cpu_features_to_string(unsigned features, char *line); void sna_threads_init(void); int sna_use_threads (int width, int height, int threshold); diff --git a/src/sna/sna_cpu.c b/src/sna/sna_cpu.c index c669eb87..d5264641 100644 --- a/src/sna/sna_cpu.c +++ b/src/sna/sna_cpu.c @@ -44,7 +44,7 @@ unsigned sna_cpu_detect(void) unsigned int eax, ebx, ecx, edx; unsigned features = 0; - __cpuid(0, eax, ebx, ecx, edx); + __cpuid(1, eax, ebx, ecx, edx); if (eax & bit_SSE3) features |= SSE3; @@ -89,3 +89,27 @@ unsigned sna_cpu_detect(void) } #endif + +char *sna_cpu_features_to_string(unsigned features, char *line) +{ + char *ret = line; + + if (features & SSE2) + line += sprintf (line, ", sse2"); + if (features & SSE3) + line += sprintf (line, ", sse3"); + if (features & SSSE3) + line += sprintf (line, ", ssse3"); + if (features & SSE4a) + line += sprintf (line, ", sse4a"); + if (features & SSE4_1) + line += sprintf (line, ", sse4.1"); + if (features & SSE4_2) + line += sprintf (line, ", sse4.2"); + if (features & AVX) + line += sprintf (line, ", avx"); + if (features & AVX2) + line += sprintf (line, ", avx2"); + + return ret + 2; +} diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 19306601..5d7a1a21 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -451,6 +451,7 @@ static Bool sna_option_cast_to_bool(struct sna *sna, int id, Bool val) static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) { struct sna *sna; + char buf[1024]; rgb defaultWeight = { 0, 0, 0 }; EntityInfoPtr pEnt; int preferred_depth; @@ -582,6 +583,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) if (xf86ReturnOptValBool(sna->Options, OPTION_CRTC_PIXMAPS, FALSE)) sna->flags |= SNA_FORCE_SHADOW; + xf86DrvMsg(scrn->scrnIndex, X_PROBED, "CPU: %s\n", + sna_cpu_features_to_string(sna->cpu_features, buf)); xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Framebuffer %s\n", sna->tiling & SNA_TILING_FB ? "tiled" : "linear"); xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Pixmaps %s\n", |