Commit 66888879 authored by Khushal's avatar Khushal Committed by Commit Bot

cc: Use decode/upload task for uploading images in GpuImageDecodeCache.

Ensure that we use upload tasks for uploading bitmaps in the Gpu image
cache. This allows the image to be locked across multiple tasks.

R=ericrk@chromium.org

Bug: 791828
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I7f82f2001846df02469e9976d12581706c1673b7
Reviewed-on: https://chromium-review.googlesource.com/1041525
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555849}
parent 6d938afc
...@@ -650,12 +650,6 @@ ImageDecodeCache::TaskResult GpuImageDecodeCache::GetTaskForImageAndRefInternal( ...@@ -650,12 +650,6 @@ ImageDecodeCache::TaskResult GpuImageDecodeCache::GetTaskForImageAndRefInternal(
if (SkipImage(draw_image)) if (SkipImage(draw_image))
return TaskResult(false); return TaskResult(false);
// For non-lazy images a decode isn't necessary.
// TODO(khushalsagar): We can still have only the upload task to upload ahead
// of raster.
if (!draw_image.paint_image().IsLazyGenerated())
return TaskResult(false);
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
const PaintImage::FrameKey frame_key = draw_image.frame_key(); const PaintImage::FrameKey frame_key = draw_image.frame_key();
ImageData* image_data = GetImageDataForDrawImage(draw_image); ImageData* image_data = GetImageDataForDrawImage(draw_image);
......
...@@ -2281,6 +2281,26 @@ TEST_P(GpuImageDecodeCacheTest, NonLazyImageUploadNoScale) { ...@@ -2281,6 +2281,26 @@ TEST_P(GpuImageDecodeCacheTest, NonLazyImageUploadNoScale) {
EXPECT_FALSE(cache->GetSWImageDecodeForTesting(draw_image)); EXPECT_FALSE(cache->GetSWImageDecodeForTesting(draw_image));
} }
TEST_P(GpuImageDecodeCacheTest, NonLazyImageUploadNoScaleTask) {
auto cache = CreateCache();
bool is_decomposable = true;
SkFilterQuality quality = kHigh_SkFilterQuality;
PaintImage image = CreateBitmapImage(gfx::Size(10, 10));
DrawImage draw_image(image, SkIRect::MakeWH(image.width(), image.height()),
quality,
CreateMatrix(SkSize::Make(1.0f, 1.0f), is_decomposable),
PaintImage::kDefaultFrameIndex, DefaultColorSpace());
auto result =
cache->GetTaskForImageAndRef(draw_image, ImageDecodeCache::TracingInfo());
EXPECT_TRUE(result.need_unref);
EXPECT_TRUE(result.task);
TestTileTaskRunner::ProcessTask(result.task->dependencies()[0].get());
TestTileTaskRunner::ProcessTask(result.task.get());
cache->UnrefImage(draw_image);
}
TEST_P(GpuImageDecodeCacheTest, NonLazyImageUploadDownscaled) { TEST_P(GpuImageDecodeCacheTest, NonLazyImageUploadDownscaled) {
auto cache = CreateCache(); auto cache = CreateCache();
bool is_decomposable = true; bool is_decomposable = true;
......
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