| Index: cc/resources/video_resource_updater.cc
|
| diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
|
| index e713c5d5857f90112eacee81246a6fb5427e9996..2ea3f4691eaeee32cbf94f12bde5951088415aeb 100644
|
| --- a/cc/resources/video_resource_updater.cc
|
| +++ b/cc/resources/video_resource_updater.cc
|
| @@ -377,32 +377,6 @@
|
| return std::unique_ptr<VideoResourceUpdater::HalfFloatMaker>(
|
| new HalfFloatMaker_libyuv(bits_per_channel));
|
| }
|
| -}
|
| -
|
| -ResourceFormat VideoResourceUpdater::YuvResourceFormat(
|
| - int bits,
|
| - media::VideoPixelFormat format) const {
|
| - if (!context_provider_)
|
| - return RGBA_8888;
|
| -
|
| - if (format == media::PIXEL_FORMAT_Y16) {
|
| - // Unable to display directly as yuv planes so convert it to RGBA for
|
| - // compositing.
|
| - return RGBA_8888;
|
| - }
|
| -
|
| - const auto caps = context_provider_->ContextCapabilities();
|
| - if (caps.disable_one_component_textures)
|
| - return RGBA_8888;
|
| -
|
| - ResourceFormat yuv_resource_format = caps.texture_rg ? RED_8 : LUMINANCE_8;
|
| - if (bits <= 8)
|
| - return yuv_resource_format;
|
| -
|
| - if (caps.texture_half_float_linear)
|
| - return LUMINANCE_F16;
|
| -
|
| - return yuv_resource_format;
|
| }
|
|
|
| VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| @@ -458,23 +432,26 @@
|
| DCHECK(media::IsYuvPlanar(input_frame_format) ||
|
| input_frame_format == media::PIXEL_FORMAT_Y16);
|
|
|
| - const bool software_compositor = context_provider_ == nullptr;
|
| - bool disable_one_component_textures = true;
|
| - if (!software_compositor) {
|
| - const auto caps = context_provider_->ContextCapabilities();
|
| - disable_one_component_textures = caps.disable_one_component_textures;
|
| - }
|
| -
|
| - ResourceFormat output_resource_format =
|
| - YuvResourceFormat(bits_per_channel, input_frame_format);
|
| + const bool software_compositor = context_provider_ == NULL;
|
| +
|
| + ResourceFormat output_resource_format;
|
| + if (input_frame_format == media::PIXEL_FORMAT_Y16) {
|
| + // Unable to display directly as yuv planes so convert it to RGBA for
|
| + // compositing.
|
| + output_resource_format = RGBA_8888;
|
| + } else {
|
| + // Can be composited directly from yuv planes.
|
| + output_resource_format =
|
| + resource_provider_->YuvResourceFormat(bits_per_channel);
|
| + }
|
|
|
| // If GPU compositing is enabled, but the output resource format
|
| // returned by the resource provider is RGBA_8888, then a GPU driver
|
| // bug workaround requires that YUV frames must be converted to RGB
|
| // before texture upload.
|
| bool texture_needs_rgb_conversion =
|
| - (!software_compositor && disable_one_component_textures) ||
|
| - input_frame_format == media::PIXEL_FORMAT_Y16;
|
| + !software_compositor &&
|
| + output_resource_format == ResourceFormat::RGBA_8888;
|
| size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format);
|
|
|
| // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB
|
| @@ -482,7 +459,7 @@
|
| // Obviously, this is suboptimal and should be addressed once ubercompositor
|
| // starts shaping up.
|
| if (software_compositor || texture_needs_rgb_conversion) {
|
| - DCHECK_EQ(output_resource_format, kRGBResourceFormat);
|
| + output_resource_format = kRGBResourceFormat;
|
| output_plane_count = 1;
|
| bits_per_channel = 8;
|
| }
|
| @@ -550,9 +527,7 @@
|
| upload_pixels_.resize(needed_size);
|
|
|
| media::SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels(
|
| - video_frame.get(),
|
| - media::SkCanvasVideoRenderer::ConvertingSize::CODED,
|
| - &upload_pixels_[0], bytes_per_row);
|
| + video_frame.get(), &upload_pixels_[0], bytes_per_row);
|
|
|
| resource_provider_->CopyToResource(plane_resource.resource_id(),
|
| &upload_pixels_[0],
|
| @@ -572,8 +547,7 @@
|
| // a sync token is not required.
|
| TextureMailbox mailbox(plane_resource.mailbox(), gpu::SyncToken(),
|
| resource_provider_->GetResourceTextureTarget(
|
| - plane_resource.resource_id()),
|
| - plane_resource.resource_size(), false, false);
|
| + plane_resource.resource_id()));
|
| mailbox.set_color_space(video_frame->ColorSpace());
|
| external_resources.mailboxes.push_back(mailbox);
|
| external_resources.release_callbacks.push_back(base::Bind(
|
| @@ -584,7 +558,7 @@
|
| }
|
|
|
| std::unique_ptr<HalfFloatMaker> half_float_maker;
|
| - if (YuvResourceFormat(bits_per_channel, input_frame_format) ==
|
| + if (resource_provider_->YuvResourceFormat(bits_per_channel) ==
|
| LUMINANCE_F16) {
|
| half_float_maker = NewHalfFloatMaker(bits_per_channel);
|
| external_resources.offset = half_float_maker->Offset();
|
| @@ -595,7 +569,7 @@
|
| PlaneResource& plane_resource = *plane_resources[i];
|
| // Update each plane's resource id with its content.
|
| DCHECK_EQ(plane_resource.resource_format(),
|
| - YuvResourceFormat(bits_per_channel, input_frame_format));
|
| + resource_provider_->YuvResourceFormat(bits_per_channel));
|
|
|
| if (!plane_resource.Matches(video_frame->unique_id(), i)) {
|
| // TODO(hubbe): Move all conversion (and upload?) code to media/.
|
|
|