add knob to turn off fancy SkJumper features

This is a new public API for testing (layout tests).

Change-Id: I10345231bad373c741b1e9656e546000538121b3
Reviewed-on: https://skia-review.googlesource.com/17712
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-05-23 11:31:14 -04:00 committed by Skia Commit-Bot
parent 435071e8ab
commit 5373609d90
4 changed files with 16 additions and 3 deletions

View File

@ -26,6 +26,10 @@ public:
// We're in the middle of cleaning this up.
static void Term() {}
// If called immediately after Init(), SkJumper will use only a per-CPU baseline
// feature set, ignoring any more advanced instructions that may be available.
static void DisableFancySkJumperFeatures();
/**
* Return the version numbers for the library. If the parameter is not
* null, it is set to the version number.

View File

@ -28,6 +28,7 @@
#include "SkTSearch.h"
#include "SkTime.h"
#include "SkUtils.h"
#include "../jumper/SkJumper.h"
#include <stdlib.h>
@ -109,3 +110,7 @@ void SkGraphics::SetFlags(const char* flags) {
flags = nextSemi + 1;
} while (nextSemi);
}
void SkGraphics::DisableFancySkJumperFeatures() {
gSkJumperEnableFancyFeatures = false;
}

View File

@ -114,6 +114,8 @@ static const SkJumper_Engine kPortable = {
static SkJumper_Engine gPlatform = kPortable;
static SkOnce gChooseEngineOnce;
bool gSkJumperEnableFancyFeatures = true;
static SkJumper_Engine choose_engine() {
#if __has_feature(memory_sanitizer)
// We'll just run portable code.
@ -137,7 +139,7 @@ static SkJumper_Engine choose_engine() {
}
#elif defined(__x86_64__) || defined(_M_X64)
if (1 && SkCpu::Supports(SkCpu::HSW)) {
if (gSkJumperEnableFancyFeatures && SkCpu::Supports(SkCpu::HSW)) {
return {
#define M(stage) ASM(stage, hsw),
{ SK_RASTER_PIPELINE_STAGES(M) },
@ -145,7 +147,7 @@ static SkJumper_Engine choose_engine() {
#undef M
};
}
if (1 && SkCpu::Supports(SkCpu::AVX)) {
if (gSkJumperEnableFancyFeatures && SkCpu::Supports(SkCpu::AVX)) {
return {
#define M(stage) ASM(stage, avx),
{ SK_RASTER_PIPELINE_STAGES(M) },
@ -153,7 +155,7 @@ static SkJumper_Engine choose_engine() {
#undef M
};
}
if (1 && SkCpu::Supports(SkCpu::SSE41)) {
if (gSkJumperEnableFancyFeatures && SkCpu::Supports(SkCpu::SSE41)) {
return {
#define M(stage) ASM(stage, sse41),
{ SK_RASTER_PIPELINE_STAGES(M) },

View File

@ -8,6 +8,8 @@
#ifndef SkJumper_DEFINED
#define SkJumper_DEFINED
extern bool gSkJumperEnableFancyFeatures;
// This file contains definitions shared by SkJumper.cpp (compiled normally as part of Skia)
// and SkJumper_stages.cpp (compiled into Skia _and_ offline into SkJumper_generated.h).
// Keep it simple!