Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Issue 390453002: Add support for NEON intrinsics to speed up texture compression. We can (Closed)

Created:
6 years, 5 months ago by krajcevski
Modified:
6 years, 5 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Add support for NEON intrinsics to speed up texture compression. We can now convert the time that we would have spent uploading the texture to compressing it giving a net 50% memory savings for these things. Committed: https://skia.googlesource.com/skia/+/bc9205be0a1094e312da098348601398c210dc5a Committed: https://skia.googlesource.com/skia/+/630598cbb87edda47aa26bc7b7f93865b34cd8de

Patch Set 1 #

Total comments: 15

Patch Set 2 : Code review comments #

Patch Set 3 : Avoid static initialization #

Patch Set 4 : Use the transpose instruction #

Patch Set 5 : Add support for maybe-NEON arm builds" #

Patch Set 6 : Fix arm and neon compatibility #

Unified diffs Side-by-side diffs Delta from patch set Stats (+371 lines, -18 lines) Patch
M gyp/opts.gyp View 1 2 3 4 10 chunks +10 lines, -0 lines 0 comments Download
M gyp/utils.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A src/opts/SkTextureCompression_opts.h View 1 1 chunk +17 lines, -0 lines 0 comments Download
A src/opts/SkTextureCompression_opts_arm.cpp View 1 2 3 4 5 1 chunk +38 lines, -0 lines 0 comments Download
A src/opts/SkTextureCompression_opts_neon.h View 1 2 3 4 5 1 chunk +14 lines, -0 lines 0 comments Download
A src/opts/SkTextureCompression_opts_neon.cpp View 1 2 3 4 5 1 chunk +239 lines, -0 lines 0 comments Download
A src/opts/SkTextureCompression_opts_none.cpp View 1 1 chunk +13 lines, -0 lines 0 comments Download
M src/utils/SkTextureCompressor.h View 1 1 chunk +8 lines, -1 line 0 comments Download
M src/utils/SkTextureCompressor.cpp View 1 2 4 chunks +31 lines, -17 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
krajcevski
Uncompressed timings: loops min median mean max stddev config bench Device supports ARM NEON instructions! ...
6 years, 5 months ago (2014-07-11 14:56:54 UTC) #1
robertphillips
The parts I understood 1gtm but I defer to Mike on this. Mike do you ...
6 years, 5 months ago (2014-07-11 15:17:47 UTC) #2
mtklein
https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp File src/opts/SkTextureCompression_opts_neon.cpp (right): https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp#newcode149 src/opts/SkTextureCompression_opts_neon.cpp:149: static void compress_r11eac_blocks(uint64_t** dst, const uint8_t* src, int rowBytes) ...
6 years, 5 months ago (2014-07-11 15:24:27 UTC) #3
krajcevski
https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp File src/opts/SkTextureCompression_opts_neon.cpp (right): https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp#newcode149 src/opts/SkTextureCompression_opts_neon.cpp:149: static void compress_r11eac_blocks(uint64_t** dst, const uint8_t* src, int rowBytes) ...
6 years, 5 months ago (2014-07-11 16:11:48 UTC) #4
krajcevski
+Kevin to find any glaring inefficiencies.
6 years, 5 months ago (2014-07-11 18:14:02 UTC) #5
mtklein
lgtm https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp File src/opts/SkTextureCompression_opts_neon.cpp (right): https://codereview.chromium.org/390453002/diff/1/src/opts/SkTextureCompression_opts_neon.cpp#newcode162 src/opts/SkTextureCompression_opts_neon.cpp:162: const uint8x16_t alphaRow1 = vld1q_u8(src1); Ah, neat. On ...
6 years, 5 months ago (2014-07-11 18:21:19 UTC) #6
krajcevski
The CQ bit was checked by krajcevski@google.com
6 years, 5 months ago (2014-07-11 18:39:17 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/krajcevski@google.com/390453002/60001
6 years, 5 months ago (2014-07-11 18:39:30 UTC) #8
commit-bot: I haz the power
Change committed as bc9205be0a1094e312da098348601398c210dc5a
6 years, 5 months ago (2014-07-11 19:12:31 UTC) #9
jcgregorio
On 2014/07/11 19:12:31, I haz the power (commit-bot) wrote: > Change committed as bc9205be0a1094e312da098348601398c210dc5a Breaking ...
6 years, 5 months ago (2014-07-11 20:11:03 UTC) #10
krajcevski
A revert of this CL has been created in https://codereview.chromium.org/384053003/ by krajcevski@google.com. The reason for ...
6 years, 5 months ago (2014-07-11 20:14:31 UTC) #11
mtklein
The CQ bit was checked by mtklein@google.com
6 years, 5 months ago (2014-07-14 18:43:30 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/krajcevski@google.com/390453002/100001
6 years, 5 months ago (2014-07-14 18:43:56 UTC) #13
commit-bot: I haz the power
Change committed as 630598cbb87edda47aa26bc7b7f93865b34cd8de
6 years, 5 months ago (2014-07-14 19:00:12 UTC) #14
kevin.petit
Hi, I've had a quick look and already have a few suggestions which I'd like ...
6 years, 5 months ago (2014-07-15 14:37:59 UTC) #15
krajcevski
6 years, 5 months ago (2014-07-15 15:00:59 UTC) #16
Message was sent while issue was closed.
On 2014/07/15 14:37:59, kevin.petit wrote:
> Hi,
> 
> I've had a quick look and already have a few suggestions which I'd like to
> benchmark. What benchmark have you used?

I used the polygon microbenchmark in nanobench, but this codepath is currently
turned off by default. To turn it on, you need to make the following changes to
src/gpu/GrSWMaskHelper.cpp:

@@@ -18,6 -18,6 +18,9 @@@
  // TODO: try to remove this #include
  #include "GrContext.h"

++#undef GR_COMPRESS_ALPHA_MASK
++#define GR_COMPRESS_ALPHA_MASK 1
++
  namespace {
  
  /*
@@@ -103,9 -103,9 +106,17 @@@ bool GrSWMaskHelper::init(const SkIRect
      SkIRect bounds = SkIRect::MakeWH(resultBounds.width(),
                                       resultBounds.height());
  
++#if GR_COMPRESS_ALPHA_MASK
++    int cmpWidth = (bounds.fRight + 15) & ~15;
++    int cmpHeight = (bounds.fBottom + 3) & ~3;
++    if (!fBM.allocPixels(SkImageInfo::MakeA8(cmpWidth, cmpHeight))) {
++        return false;
++    }
++#else
      if (!fBM.allocPixels(SkImageInfo::MakeA8(bounds.fRight, bounds.fBottom)))
{
          return false;
      }
++#endif
      sk_bzero(fBM.getPixels(), fBM.getSafeSize());
  
      sk_bzero(&fDraw, sizeof(fDraw));
@@@ -127,9 -127,9 +138,9 @@@ bool GrSWMaskHelper::getTexture(GrAutoS
      desc.fHeight = fBM.height();
  
  #if GR_COMPRESS_ALPHA_MASK
--    static const int kLATCBlockSize = 4;
--    if (desc.fWidth % kLATCBlockSize == 0 && desc.fHeight % kLATCBlockSize ==
0) {
--        desc.fConfig = kLATC_GrPixelConfig;
++    static const int kR11_EACBlockSize = 4;
++    if (desc.fWidth % kR11_EACBlockSize == 0 && desc.fHeight %
kR11_EACBlockSize == 0) {
++        desc.fConfig = kR11_EAC_GrPixelConfig;
      } else {
  #endif
          desc.fConfig = kAlpha_8_GrPixelConfig;
@@@ -168,8 -168,8 +179,8 @@@ void GrSWMaskHelper::toTexture(GrTextur
      desc.fConfig = texture->config();
          
      // First see if we should compress this texture before uploading.
--    if (texture->config() == kLATC_GrPixelConfig) {
--        SkTextureCompressor::Format format =
SkTextureCompressor::kLATC_Format;
++    if (texture->config() == kR11_EAC_GrPixelConfig) {
++        SkTextureCompressor::Format format =
SkTextureCompressor::kR11_EAC_Format;
          SkAutoDataUnref
latcData(SkTextureCompressor::CompressBitmapToFormat(fBM, format));
          SkASSERT(NULL != latcData);

Powered by Google App Engine
This is Rietveld 408576698