Commit e9928022 authored by Jamie Madill's avatar Jamie Madill Committed by Commit Bot

Revert "cc: Cache text blobs in the GPU service."

This reverts commit 57df0676.

Reason for revert: Seems to be causing a crash on Mac.

https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Mac%20FYI%2010.14%20Release%20%28Intel%29/327
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Mac%20FYI%20Experimental%20Release%20%28Intel%29/6072

Crash in __ZN13GrCCPathCache5evictEP18GrCCPathCacheEntry

Bug: 897507

Original change's description:
> cc: Cache text blobs in the GPU service.
> 
> Since skia's internal caching is keyed on text blobs, its important to
> reuse the same object. Make sure we cache text blobs in the
> ServiceTransferCache to get a cache hit in skia.
> 
> R=​enne@chromium.org
> 
> Bug: 894200
> Change-Id: I8808d649ca3520211d034e07e7d4670ffb39094c
> Reviewed-on: https://chromium-review.googlesource.com/c/1292722
> Commit-Queue: Khushal <khushalsagar@chromium.org>
> Reviewed-by: enne <enne@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#601404}

TBR=enne@chromium.org,khushalsagar@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 894200
Change-Id: I5e0a151c5a539aa8a9b6cac5f9bcf710ba2f405a
Reviewed-on: https://chromium-review.googlesource.com/c/1292384Reviewed-by: default avatarJamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601451}
parent d2a37181
......@@ -77,8 +77,6 @@ cc_component("paint") {
"skottie_wrapper.h",
"solid_color_analyzer.cc",
"solid_color_analyzer.h",
"textblob_transfer_cache_entry.cc",
"textblob_transfer_cache_entry.h",
"transfer_cache_deserialize_helper.h",
"transfer_cache_entry.cc",
"transfer_cache_entry.h",
......
......@@ -15,7 +15,6 @@
#include "cc/paint/paint_shader.h"
#include "cc/paint/path_transfer_cache_entry.h"
#include "cc/paint/shader_transfer_cache_entry.h"
#include "cc/paint/textblob_transfer_cache_entry.h"
#include "cc/paint/transfer_cache_deserialize_helper.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRRect.h"
......@@ -377,11 +376,6 @@ void PaintOpReader::Read(sk_sp<SkColorSpace>* color_space) {
void PaintOpReader::Read(sk_sp<SkTextBlob>* blob) {
AlignMemory(4);
uint32_t blob_id = 0u;
Read(&blob_id);
if (!valid_)
return;
size_t data_bytes = 0u;
ReadSize(&data_bytes);
if (remaining_bytes_ < data_bytes || data_bytes == 0u)
......@@ -389,16 +383,6 @@ void PaintOpReader::Read(sk_sp<SkTextBlob>* blob) {
if (!valid_)
return;
auto* entry =
options_.transfer_cache->GetEntryAs<ServiceTextBlobTransferCacheEntry>(
blob_id);
if (entry) {
*blob = entry->blob();
memory_ += data_bytes;
remaining_bytes_ -= data_bytes;
return;
}
DCHECK(options_.strike_client);
SkDeserialProcs procs;
TypefaceCtx typeface_ctx(options_.strike_client);
......@@ -410,9 +394,6 @@ void PaintOpReader::Read(sk_sp<SkTextBlob>* blob) {
SetInvalid();
return;
}
options_.transfer_cache->CreateLocalEntry(
blob_id, std::make_unique<ServiceTextBlobTransferCacheEntry>(
deserialized_blob, data_bytes));
*blob = std::move(deserialized_blob);
memory_ += data_bytes;
......
......@@ -291,10 +291,6 @@ void PaintOpWriter::Write(const sk_sp<SkTextBlob>& blob) {
if (!valid_)
return;
AlignMemory(4);
uint32_t blob_id = blob->uniqueID();
Write(blob_id);
uint64_t* size_memory = WriteSize(0u);
if (!valid_)
return;
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/paint/textblob_transfer_cache_entry.h"
namespace cc {
ServiceTextBlobTransferCacheEntry::ServiceTextBlobTransferCacheEntry(
sk_sp<SkTextBlob> blob,
size_t size)
: blob_(std::move(blob)), size_(size) {}
ServiceTextBlobTransferCacheEntry::~ServiceTextBlobTransferCacheEntry() =
default;
size_t ServiceTextBlobTransferCacheEntry::CachedSize() const {
return size_;
}
bool ServiceTextBlobTransferCacheEntry::Deserialize(
GrContext* context,
base::span<const uint8_t> data) {
NOTREACHED();
return false;
}
} // namespace cc
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_PAINT_TEXTBLOB_TRANSFER_CACHE_ENTRY_H_
#define CC_PAINT_TEXTBLOB_TRANSFER_CACHE_ENTRY_H_
#include "cc/paint/paint_export.h"
#include "cc/paint/transfer_cache_entry.h"
#include "third_party/skia/include/core/SkTextBlob.h"
namespace cc {
class CC_PAINT_EXPORT ServiceTextBlobTransferCacheEntry
: public ServiceTransferCacheEntryBase<TransferCacheEntryType::kTextBlob> {
public:
ServiceTextBlobTransferCacheEntry(sk_sp<SkTextBlob> blob, size_t size);
~ServiceTextBlobTransferCacheEntry() final;
size_t CachedSize() const final;
bool Deserialize(GrContext* context, base::span<const uint8_t> data) final;
const sk_sp<SkTextBlob>& blob() const { return blob_; }
private:
sk_sp<SkTextBlob> blob_;
const size_t size_;
};
} // namespace cc
#endif // CC_PAINT_TEXTBLOB_TRANSFER_CACHE_ENTRY_H_
......@@ -27,9 +27,8 @@ std::unique_ptr<ServiceTransferCacheEntry> ServiceTransferCacheEntry::Create(
case TransferCacheEntryType::kPath:
return std::make_unique<ServicePathTransferCacheEntry>();
case TransferCacheEntryType::kShader:
case TransferCacheEntryType::kTextBlob:
// ServiceShader/TextBlobTransferCache is only created via
// CreateLocalEntry and is never serialized/deserialized.
// ServiceShaderTransferCache is only created via CreateLocalEntry
// and is never serialized/deserialized.
return nullptr;
}
......
......@@ -25,9 +25,8 @@ enum class TransferCacheEntryType : uint32_t {
kColorSpace,
kPath,
kShader,
kTextBlob,
// Add new entries above this line, make sure to update kLast.
kLast = kTextBlob,
kLast = kShader,
};
// An interface used on the client to serialize a transfer cache entry
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment