Revert of DM: lazy decoding on SKP playback (patchset #4 id:60001 of https://codereview.chromium.org/943383002/)

Reason for revert:
crashing dm

Test-Mac10.9-MacMini6.2-HD4000-x86_64-Debug

u gm addarc
(1431MB   932) 169ms	gpu gm aarectmodes
(1431MB   931) 38.6ms	gpu gm aaclip
(1431MB   930) 474ms	gpu skp desk_amazon.skp
(1431MB   929) 615ms	gpu skp desk_baidu.skp
(1431MB   928) 600ms	gpu skp desk_blogger.skp
Signal 11:
_sigtramp (+0x1a)
compute_yuv_size(jpeg_decompress_struct const&, int, SizeType) (+0x30)
update_components_sizes(jpeg_decompress_struct const&, SkTSize<int>*, SizeType) (+0x46)
SkJPEGImageDecoder::onDecodeYUV8Planes(SkStream*, SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x239)
SkImageDecoder::decodeYUV8Planes(SkStream*, SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x64)
SkImageDecoderGenerator::onGetYUV8Planes(SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x9f)
SkImageGenerator::getYUV8Planes(SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x3b7)
SkDiscardablePixelRef::onGetYUV8Planes(SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x3c)
SkPixelRef::getYUV8Planes(SkTSize<int>*, void**, unsigned long*, SkYUVColorSpace*) (+0x55)
load_yuv_texture(GrContext*, GrUniqueKey const&, SkBitmap const&, GrSurfaceDesc const&) (+0x24b)
create_unstretched_bitmap_texture(GrContext*, SkBitmap const&, GrUniqueKey const&) (+0x3df)
create_bitmap_texture(GrContext*, SkBitmap const&, Stretch, GrUniqueKey const&, GrUniqueKey const&) (+0x1ca)
GrRefCachedBitmapTexture(GrContext*, SkBitmap const&, GrTextureParams const*) (+0x368)
AutoBitmapTexture::set(GrContext*, SkBitmap const&, GrTextureParams const*) (+0x87)
AutoBitmapTexture::AutoBitmapTexture(GrContext*, SkBitmap const&, GrTextureParams const*, GrTexture**) (+0xe0)
AutoBitmapTexture::AutoBitmapTexture(GrContext*, SkBitmap const&, GrTextureParams const*, GrTexture**) (+0x35)
SkGpuDevice::internalDrawBitmap(SkBitmap const&, SkMatrix const&, SkRect const&, GrTextureParams const&, SkPaint const&, SkCanvas::DrawBitmapRectFlags, bool, bool) (+0x118)
SkGpuDevice::drawBitmapCommon(SkDraw const&, SkBitmap const&, SkRect const*, SkSize const*, SkPaint const&, SkCanvas::DrawBitmapRectFlags) (+0xa84)
SkGpuDevice::drawBitmapRect(SkDraw const&, SkBitmap const&, SkRect const*, SkRect const&, SkPaint const&, SkCanvas::DrawBitmapRectFlags) (+0x2bb)
SkCanvas::internalDrawBitmapRect(SkBitmap const&, SkRect const*, SkRect const&, SkPaint const*, SkCanvas::DrawBitmapRectFlags) (+0x2a9)
SkCanvas::onDrawBitmapRect(SkBitmap const&, SkRect const*, SkRect const&, SkPaint const*, SkCanvas::DrawBitmapRectFlags) (+0x118)
SkCanvas::drawBitmapRectToRect(SkBitmap const&, SkRect const*, SkRect const&, SkPaint const*, SkCanvas::DrawBitmapRectFlags) (+0x60)
void SkRecords::Draw::draw<SkRecords::DrawBitmapRectToRect>(SkRecords::DrawBitmapRectToRect const&) (+0x8a)
void SkRecords::Draw::operator()<SkRecords::DrawBitmapRectToRect>(SkRecords::DrawBitmapRectToRect const&) (+0x1d)
void SkRecord::Record::visit<void, SkRecords::Draw>(SkRecord::Type8, SkRecords::Draw&) const (+0x298)
void SkRecord::visit<void, SkRecords::Draw>(unsigned int, SkRecords::Draw&) const (+0xbc)
SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) (+0x2eb)
SkPicture::playback(SkCanvas*, SkPicture::AbortCallback*) const (+0x186)
SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) (+0xe0)
SkCanvas::drawPicture(SkPicture const*) (+0x11b)
DM::SKPSrc::draw(SkCanvas*) const (+0x25b)
DM::GPUSink::draw(DM::Src const&, SkBitmap*, SkWStream*, SkString*) const (+0x21d)
Task::Run(Task*) (+0x1de)
run_enclave(SkTArray<Task, false>*) (+0x49)
run_enclave_and_gpu_tests(SkTArray<Task, false>*) (+0x15)
(anonymous namespace)::ThreadPool::Wait(int*) (+0x14b)
SkTaskGroup::wait() (+0x15)
dm_main() (+0x624)
main (+0x27)

Original issue's description:
> DM: lazy decoding on SKP playback
>
> Command `out/Release/dm --config pdf --src gm skp`, uses 27% less RAM.
>
> Committed: https://skia.googlesource.com/skia/+/77d366d72a6ae83fb0abcb2ec7e2d692fef2e923

TBR=mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/947103005
This commit is contained in:
halcanary 2015-02-23 10:43:48 -08:00 committed by Commit bot
parent 77d366d72a
commit 44906c6628

View File

@ -1,9 +1,7 @@
#include "DMSrcSink.h"
#include "SamplePipeControllers.h"
#include "SkCommonFlags.h"
#include "SkData.h"
#include "SkDocument.h"
#include "SkImageGenerator.h"
#include "SkMultiPictureDraw.h"
#include "SkNullCanvas.h"
#include "SkOSFile.h"
@ -13,11 +11,6 @@
#include "SkStream.h"
#include "SkXMLWriter.h"
static bool lazy_decode_bitmap(const void* src, size_t size, SkBitmap* dst) {
SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, size));
return encoded && SkInstallDiscardablePixelRef(encoded, dst);
}
namespace DM {
GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {}
@ -121,7 +114,7 @@ Error SKPSrc::draw(SkCanvas* canvas) const {
if (!stream) {
return SkStringPrintf("Couldn't read %s.", fPath.c_str());
}
SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream, &lazy_decode_bitmap));
SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream));
if (!pic) {
return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str());
}
@ -386,7 +379,7 @@ Error ViaSerialization::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream
SkDynamicMemoryWStream wStream;
pic->serialize(&wStream);
SkAutoTDelete<SkStream> rStream(wStream.detachAsStream());
SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream, &lazy_decode_bitmap));
SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream));
// Turn that deserialized picture into a Src, draw it into our Sink to fill bitmap or stream.
struct ProxySrc : public Src {