Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 034ad53

Browse files
Merge to M46 for BUG=510252
Add ycbcr_422 support in image factory. BUG=524582 [email protected] Review URL: https://codereview.chromium.org/1308643003 Cr-Commit-Position: refs/heads/master@{#345959} (cherry picked from commit 3055ce7) media: Remove SkCanvasVideoRenderer cache invalidation. When VideoFrame carries one native texture, with a GL_TEXTURE_2D target, we assumed we could avoid caching the created SkImage, since we just used the texture directly for drawing. Unfortunately if we're drawing to a software canvas we need to read the pixels back from the texture, and that is expensive. Keeping the same SkImage allows Skia to cache the expensive operation. BUG=521531 Review URL: https://codereview.chromium.org/1320613003 Cr-Commit-Position: refs/heads/master@{#345799} (cherry picked from commit 771b5cf) BUG=510252 Review URL: https://codereview.chromium.org/1327513003 . Cr-Commit-Position: refs/branch-heads/2490@{#201} Cr-Branched-From: 7790a35-refs/heads/master@{#344925}
1 parent 320e32b commit 034ad53

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

gpu/command_buffer/service/image_factory.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ gfx::BufferFormat ImageFactory::DefaultBufferFormatForImageFormat(
3939
return gfx::BufferFormat::ETC1;
4040
case GL_RGB_YUV_420_CHROMIUM:
4141
return gfx::BufferFormat::YUV_420;
42+
case GL_RGB_YCBCR_422_CHROMIUM:
43+
return gfx::BufferFormat::UYVY_422;
4244
default:
4345
NOTREACHED();
4446
return gfx::BufferFormat::RGBA_8888;
@@ -74,11 +76,10 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
7476
case gfx::BufferFormat::R_8:
7577
case gfx::BufferFormat::RGBA_8888:
7678
case gfx::BufferFormat::YUV_420:
79+
case gfx::BufferFormat::UYVY_422:
7780
return format == DefaultBufferFormatForImageFormat(internalformat);
7881
case gfx::BufferFormat::RGBA_4444:
7982
return internalformat == GL_RGBA;
80-
case gfx::BufferFormat::UYVY_422:
81-
return internalformat == GL_RGB;
8283
}
8384

8485
NOTREACHED();
@@ -103,11 +104,12 @@ bool ImageFactory::IsGpuMemoryBufferFormatSupported(
103104
return capabilities.texture_format_etc1;
104105
case gfx::BufferFormat::R_8:
105106
return capabilities.texture_rg;
107+
case gfx::BufferFormat::UYVY_422:
108+
return capabilities.image_ycbcr_422;
106109
case gfx::BufferFormat::RGBA_4444:
107110
case gfx::BufferFormat::RGBA_8888:
108111
case gfx::BufferFormat::BGRX_8888:
109112
case gfx::BufferFormat::YUV_420:
110-
case gfx::BufferFormat::UYVY_422:
111113
return true;
112114
}
113115

media/blink/skcanvas_video_renderer.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
127127
return skia::AdoptRef(img);
128128
}
129129

130-
bool ShouldCacheVideoFrameSkImage(const VideoFrame* video_frame) {
131-
return !video_frame->HasTextures() ||
132-
media::VideoFrame::NumPlanes(video_frame->format()) != 1 ||
133-
video_frame->mailbox_holder(0).texture_target != GL_TEXTURE_2D;
134-
}
135-
136130
// Creates a SkImage from a |video_frame| backed by native resources.
137131
// The SkImage will take ownership of the underlying resource.
138132
skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative(
@@ -388,9 +382,6 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
388382
// Make sure to flush so we can remove the videoframe from the generator.
389383
canvas->flush();
390384

391-
if (!ShouldCacheVideoFrameSkImage(video_frame.get()))
392-
ResetCache();
393-
394385
if (video_frame->HasTextures()) {
395386
DCHECK(gl);
396387
SyncPointClientImpl client(gl);

0 commit comments

Comments
 (0)