Created
January 4, 2016 21:25
-
-
Save astojilj/9ab932d41e89f08ad825 to your computer and use it in GitHub Desktop.
1-2-2-2-3.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I/GFX 1 ( 4299): took 0.001461ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.384077ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001077ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000538ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.007846ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001616ms for 192*192 texture 4 | |
I/GFX 2_1 ( 4299): took 0.025153ms for 192*192 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000769ms for 192*192 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000616ms for 192*192 texture 4 | |
I/GFX 3 ( 4299): took 0.006461ms for 192*192 texture 4 | |
I/GFX 1 ( 4299): took 0.001615ms for 192*192 texture 4 | |
I/GFX 2_1 ( 4299): took 0.010308ms for 192*192 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000615ms for 192*192 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000616ms for 192*192 texture 4 | |
I/GFX 3 ( 4299): took 0.005692ms for 192*192 texture 4 | |
I/GFX 1 ( 4299): took 0.001924ms for 48*48 texture 4 | |
I/GFX 2_1 ( 4299): took 0.013616ms for 48*48 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000615ms for 48*48 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000692ms for 48*48 texture 4 | |
I/GFX 3 ( 4299): took 0.005154ms for 48*48 texture 4 | |
I/GFX 1 ( 4299): took 0.001615ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.170846ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000846ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000692ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.008615ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001462ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.149693ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001462ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000616ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.013385ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001462ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.413846ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001000ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000693ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.017000ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001538ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.158077ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000846ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000616ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.010000ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001846ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.342693ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001308ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.001154ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.013847ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.002308ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.312077ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000846ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.009615ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001769ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.056230ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000769ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000616ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.009769ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.002538ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.110769ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000923ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000923ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.010308ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001539ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.106231ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000769ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.009385ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.002308ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.113385ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001077ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000846ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.009692ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001461ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.342154ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001154ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000692ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.007847ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001462ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.693846ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001308ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.015231ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001769ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.301077ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001076ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.001077ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.015000ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.002077ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.163769ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.030847ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.002231ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.187769ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.001308ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000615ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.016616ms for 2320*1024 texture 4 | |
I/GFX 1 ( 4299): took 0.001384ms for 2320*1024 texture 4 | |
I/GFX 2_1 ( 4299): took 0.133616ms for 2320*1024 texture 4 | |
I/GFX 2_2 ( 4299): took 0.000847ms for 2320*1024 texture 4 | |
I/GFX 2_3 ( 4299): took 0.000846ms for 2320*1024 texture 4 | |
I/GFX 3 ( 4299): took 0.010154ms for 2320*1024 texture 4 | |
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp | |
index 2124d65..24c46bd 100644 | |
--- a/src/core/SkImageCacherator.cpp | |
+++ b/src/core/SkImageCacherator.cpp | |
@@ -229,6 +229,30 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) { | |
return tex; | |
} | |
+#define SKGR_DEBUG | |
+#ifdef SKGR_DEBUG | |
+ | |
+#include <android/log.h> | |
+ | |
+#include <time.h> | |
+ | |
+using namespace std; | |
+static double elapsed(timespec start, timespec end) | |
+{ | |
+ return (end.tv_sec-start.tv_sec)*1000 + (end.tv_nsec-start.tv_nsec) * 0.000001; | |
+} | |
+ | |
+#define ELAPSE_START timespec time1, time2; clock_gettime(CLOCK_MONOTONIC, &time1);double elapsedMiliseconds; | |
+ | |
+#define ELAPSE_END(a, ...) clock_gettime(CLOCK_MONOTONIC, &time2); \ | |
+ elapsedMiliseconds = elapsed(time1, time2); \ | |
+ __android_log_print(ANDROID_LOG_INFO, a, "took %fms for %d*%d texture %d", elapsedMiliseconds, __VA_ARGS__); \ | |
+ clock_gettime(CLOCK_MONOTONIC, &time1); | |
+#else | |
+#define ELAPSE_START | |
+#define ELAPSE_END(a, ...) | |
+#endif | |
+ | |
/* | |
* We have a 5 ways to try to return a texture (in sorted order) | |
* | |
@@ -247,8 +271,54 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key | |
} | |
} | |
+ // 2. Ask the generator to natively create one | |
+ { | |
+ ELAPSE_START | |
+ { | |
+ ScopedGenerator generator(this); | |
+ SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width(), fInfo.height()); | |
+ if (GrTexture* tex = generator->generateTexture(ctx, &subset)) { | |
+ return set_key_and_return(tex, key); | |
+ } | |
+ } | |
+ ELAPSE_END("GFX 1", fInfo.width(), fInfo.height(), fInfo.colorType()); | |
+ } | |
+ | |
+ const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo); | |
+ | |
+ // 3. Ask the generator to return a compressed form that the GPU might support | |
+ { | |
+ ELAPSE_START | |
+ { | |
+ SkAutoTUnref<SkData> data(this->refEncoded()); | |
+ ELAPSE_END("GFX 2_1", fInfo.width(), fInfo.height(), fInfo.colorType()); | |
+ if (data) { | |
+ GrTexture* tex = load_compressed_into_texture(ctx, data, desc); | |
+ ELAPSE_END("GFX 2_2", fInfo.width(), fInfo.height(), fInfo.colorType()); | |
+ if (tex) { | |
+ return set_key_and_return(tex, key); | |
+ } | |
+ } | |
+ } | |
+ ELAPSE_END("GFX 2_3", fInfo.width(), fInfo.height(), fInfo.colorType()); | |
+ } | |
+ | |
+ // 4. Ask the generator to return YUV planes, which the GPU can convert | |
+ { | |
+ ELAPSE_START | |
{ | |
ScopedGenerator generator(this); | |
+ Generator_GrYUVProvider provider(generator); | |
+ GrTexture* tex = provider.refAsTexture(ctx, desc, true); | |
+ if (tex) { | |
+ return set_key_and_return(tex, key); | |
+ } | |
+ } | |
+ ELAPSE_END("GFX 3", fInfo.width(), fInfo.height(), fInfo.colorType()); | |
+ } | |
+ | |
+/* { | |
+ ScopedGenerator generator(this); | |
// 2. Ask the generator to natively create one | |
if (generator->getContentFlags() & SkImageGenerator::kCanGenerateTexture_ContentFlag) { | |
@@ -280,7 +350,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key | |
} | |
} | |
} | |
- | |
+*/ | |
// 5. Ask the generator to return RGB(A) data, which the GPU can convert | |
SkBitmap bitmap; | |
if (this->tryLockAsBitmap(&bitmap, client, chint)) { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment