Remove ViaDDL

With the removal of promise image texture caching here (https://skia-review.googlesource.com/c/skia/+/375201) we no longer need these configs.

This can't land until after (https://skia-review.googlesource.com/c/skia/+/376221) which removes use of these configs on the bots.

Change-Id: I49e122fc820d5b72498b65933e15bcc74c0f3fa3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376219
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2021-02-25 17:30:59 -05:00 committed by Skia Commit-Bot
parent 3e5871c498
commit 1cc7d45f9a
5 changed files with 0 additions and 117 deletions

View File

@ -1032,8 +1032,6 @@ static Sink* create_via(const SkString& tag, Sink* wrapped) {
#endif
VIA("serialize", ViaSerialization, wrapped);
VIA("pic", ViaPicture, wrapped);
VIA("ddl", ViaDDL, 1, 3, wrapped);
VIA("ddl2", ViaDDL, 2, 3, wrapped);
if (FLAGS_matrix.count() == 4) {
SkMatrix m;

View File

@ -2241,102 +2241,6 @@ Result ViaSerialization::draw(
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
ViaDDL::ViaDDL(int numReplays, int numDivisions, Sink* sink)
: Via(sink), fNumReplays(numReplays), fNumDivisions(numDivisions) {}
Result ViaDDL::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {
auto size = src.size();
SkPictureRecorder recorder;
Result result = src.draw(nullptr, recorder.beginRecording(SkIntToScalar(size.width()),
SkIntToScalar(size.height())));
if (!result.isOk()) {
return result;
}
sk_sp<SkPicture> inputPicture(recorder.finishRecordingAsPicture());
// this is our ultimate final drawing area/rect
SkIRect viewport = SkIRect::MakeWH(size.fWidth, size.fHeight);
DDLPromiseImageHelper promiseImageHelper(SkYUVAPixmapInfo::SupportedDataTypes::All());
sk_sp<SkData> compressedPictureData = promiseImageHelper.deflateSKP(inputPicture.get());
if (!compressedPictureData) {
return Result::Fatal("ViaDDL: Couldn't deflate SkPicture");
}
auto draw = [&](SkCanvas* canvas) -> Result {
auto direct = canvas->recordingContext() ? canvas->recordingContext()->asDirectContext()
: nullptr;
if (!direct) {
return Result::Fatal("ViaDDL: DDLs are GPU only");
}
SkSurface* tmp = canvas->getSurface();
if (!tmp) {
return Result::Fatal("ViaDDL: cannot get surface from canvas");
}
sk_sp<SkSurface> dstSurface = sk_ref_sp(tmp);
SkSurfaceCharacterization dstCharacterization;
SkAssertResult(dstSurface->characterize(&dstCharacterization));
promiseImageHelper.createCallbackContexts(direct);
// This is here bc this is the first point where we have access to the context
promiseImageHelper.uploadAllToGPU(nullptr, direct);
// We draw N times, with a clear between.
for (int replay = 0; replay < fNumReplays; ++replay) {
if (replay > 0) {
// Clear the drawing of the previous replay
canvas->clear(SK_ColorTRANSPARENT);
}
// First, create all the tiles (including their individual dest surfaces)
DDLTileHelper tiles(direct, dstCharacterization, viewport, fNumDivisions,
/* addRandomPaddingToDst */ false);
tiles.createBackendTextures(nullptr, direct);
// Second, reinflate the compressed picture individually for each thread
// This recreates the promise SkImages on each replay iteration. We are currently
// relying on this to test using a SkPromiseImageTexture to fulfill different
// SkImages. On each replay the promise SkImages are recreated in createSKPPerTile.
tiles.createSKPPerTile(compressedPictureData.get(), promiseImageHelper);
// Third, create the DDLs in parallel
tiles.createDDLsInParallel();
if (replay == fNumReplays - 1) {
// All the DDLs are created and they ref any created promise images which,
// in turn, ref the callback contexts. If it is the last run, drop the
// promise image helper's refs on the callback contexts.
promiseImageHelper.reset();
// Note: we cannot drop the tiles' callback contexts here bc they are needed
// to create each tile's destination surface.
}
// Fourth, synchronously render the display lists into the dest tiles
// TODO: it would be cool to not wait until all the tiles are drawn to begin
// drawing to the GPU and composing to the final surface
tiles.precompileAndDrawAllTiles(direct);
if (replay == fNumReplays - 1) {
// At this point the compose DDL holds refs to the composition promise images
// which, in turn, hold refs on the tile callback contexts. If it is the last run,
// drop the refs on tile callback contexts.
tiles.dropCallbackContexts();
}
dstSurface->draw(tiles.composeDDL());
// We need to ensure all the GPU work is finished so the promise image callback
// contexts will delete all the backend textures.
direct->flush();
direct->submit(true);
}
return Result::Ok();
};
return draw_to_canvas(fSink.get(), bitmap, stream, log, size, draw);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Result ViaPicture::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {
auto size = src.size();
Result result = draw_to_canvas(fSink.get(), bitmap, stream, log, size, [&](SkCanvas* canvas) {

View File

@ -626,15 +626,6 @@ public:
Result draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
};
class ViaDDL : public Via {
public:
ViaDDL(int numReplays, int numDivisions, Sink* sink);
Result draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
private:
const int fNumReplays;
const int fNumDivisions;
};
class ViaSVG : public Via {
public:
explicit ViaSVG(Sink* sink) : Via(sink) {}

View File

@ -361,14 +361,6 @@ void DDLTileHelper::kickOffThreadedWork(SkTaskGroup* recordingTaskGroup,
recordingTaskGroup->add([this] { this->createComposeDDL(); });
}
// Only called from ViaDDL
void DDLTileHelper::precompileAndDrawAllTiles(GrDirectContext* direct) {
for (int i = 0; i < this->numTiles(); ++i) {
fTiles[i].precompile(direct);
fTiles[i].draw(direct);
}
}
// Only called from skpbench
void DDLTileHelper::interleaveDDLCreationAndDraw(GrDirectContext* direct) {
for (int i = 0; i < this->numTiles(); ++i) {

View File

@ -123,8 +123,6 @@ public:
void createComposeDDL();
const sk_sp<SkDeferredDisplayList>& composeDDL() const { return fComposeDDL; }
void precompileAndDrawAllTiles(GrDirectContext*);
// For each tile, create its DDL and then draw it - all on a single thread. This is to allow
// comparison w/ just drawing the SKP directly (i.e., drawAllTilesDirectly). The
// DDL creations and draws are interleaved to prevent starvation of the GPU.