Commit 6a090ff3 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Reset context state when using skia for transfer cache image upload.

We currently mark the RasterDecoderContextState dirty at all entry
points where skia may have used it, except when uploading images using
it during transfer cache deserialization. We should do that here too.

R=enne@chromium.org, piman@chromium.org

Bug: 897637
Change-Id: Ie713728eab9f33a7e14ed983e574e43e4053124c
Reviewed-on: https://chromium-review.googlesource.com/c/1341141Reviewed-by: default avatarenne <enne@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609095}
parent 854590d2
......@@ -42,4 +42,19 @@ bool ServiceTransferCacheEntry::SafeConvertToType(
return true;
}
// static
bool ServiceTransferCacheEntry::UsesGrContext(TransferCacheEntryType type) {
switch (type) {
case TransferCacheEntryType::kRawMemory:
case TransferCacheEntryType::kColorSpace:
case TransferCacheEntryType::kShader:
return false;
case TransferCacheEntryType::kImage:
return true;
}
NOTREACHED();
return true;
}
} // namespace cc
......@@ -70,6 +70,9 @@ class CC_PAINT_EXPORT ServiceTransferCacheEntry {
static bool SafeConvertToType(uint32_t raw_type,
TransferCacheEntryType* type);
// Returns true if the entry needs a GrContext during deserialization.
static bool UsesGrContext(TransferCacheEntryType type);
virtual ~ServiceTransferCacheEntry() {}
// Returns the type of this entry.
......
......@@ -3250,10 +3250,18 @@ void RasterDecoderImpl::DoCreateTransferCacheEntryINTERNAL(
ServiceDiscardableHandle handle(std::move(handle_buffer), handle_shm_offset,
handle_shm_id);
// If the entry is going to use skia during deserialization, make sure we mark
// the context state dirty.
GrContext* context_for_entry =
cc::ServiceTransferCacheEntry::UsesGrContext(entry_type) ? gr_context()
: nullptr;
if (context_for_entry)
raster_decoder_context_state_->need_context_state_reset = true;
if (!transfer_cache()->CreateLockedEntry(
ServiceTransferCache::EntryKey(raster_decoder_id_, entry_type,
entry_id),
handle, gr_context(), base::make_span(data_memory, data_size))) {
handle, context_for_entry, base::make_span(data_memory, data_size))) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCreateTransferCacheEntryINTERNAL",
"Failure to deserialize transfer cache entry.");
return;
......
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