| Index: ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| index b18238e893c6d21834add54e6d4a862013579af5..1113bb68c22094cfd03b2c942638f386aed4ac4d 100644
|
| --- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| +++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| @@ -22,11 +22,6 @@
|
| #include "ui/ozone/public/ozone_platform.h"
|
| #include "ui/ozone/public/surface_factory_ozone.h"
|
|
|
| -namespace {
|
| -// Optimal format for rendering on overlay.
|
| -const gfx::BufferFormat kOverlayRenderFormat = gfx::BufferFormat::UYVY_422;
|
| -} // namespace
|
| -
|
| namespace ui {
|
|
|
| GbmBuffer::GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
|
| @@ -152,19 +147,26 @@ gfx::Size GbmPixmap::GetBufferSize() const {
|
| bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| int plane_z_order,
|
| gfx::OverlayTransform plane_transform,
|
| + gfx::BufferFormat storage_format,
|
| const gfx::Rect& display_bounds,
|
| - const gfx::RectF& crop_rect) {
|
| - gfx::Size target_size;
|
| - gfx::BufferFormat target_format;
|
| - if (plane_z_order && ShouldApplyProcessing(display_bounds, crop_rect,
|
| - &target_size, &target_format)) {
|
| - scoped_refptr<NativePixmap> processed_pixmap =
|
| - GetProcessedPixmap(target_size, target_format);
|
| - if (processed_pixmap) {
|
| - return processed_pixmap->ScheduleOverlayPlane(
|
| - widget, plane_z_order, plane_transform, display_bounds, crop_rect);
|
| - } else {
|
| - return false;
|
| + const gfx::RectF& crop_rect,
|
| + bool handle_scaling) {
|
| + if (plane_z_order) {
|
| + gfx::Size target_size = buffer_->GetSize();
|
| + gfx::BufferFormat current_format =
|
| + GetBufferFormatFromFourCCFormat(buffer_->GetFramebufferPixelFormat());
|
| + if (current_format != storage_format ||
|
| + (handle_scaling &&
|
| + ShouldScaleContent(display_bounds, crop_rect, &target_size))) {
|
| + scoped_refptr<NativePixmap> processed_pixmap =
|
| + GetProcessedPixmap(target_size, storage_format);
|
| + if (processed_pixmap) {
|
| + return processed_pixmap->ScheduleOverlayPlane(
|
| + widget, plane_z_order, plane_transform, storage_format,
|
| + display_bounds, crop_rect, handle_scaling);
|
| + } else {
|
| + return false;
|
| + }
|
| }
|
| }
|
|
|
| @@ -180,10 +182,9 @@ bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| return true;
|
| }
|
|
|
| -bool GbmPixmap::ShouldApplyProcessing(const gfx::Rect& display_bounds,
|
| - const gfx::RectF& crop_rect,
|
| - gfx::Size* target_size,
|
| - gfx::BufferFormat* target_format) {
|
| +bool GbmPixmap::ShouldScaleContent(const gfx::Rect& display_bounds,
|
| + const gfx::RectF& crop_rect,
|
| + gfx::Size* target_size) {
|
| if (crop_rect.width() == 0 || crop_rect.height() == 0) {
|
| PLOG(ERROR) << "ShouldApplyProcessing passed zero processing target.";
|
| return false;
|
| @@ -194,16 +195,13 @@ bool GbmPixmap::ShouldApplyProcessing(const gfx::Rect& display_bounds,
|
| return false;
|
| }
|
|
|
| - // TODO(william.xie): Figure out the optimal render format for overlay.
|
| - // See http://crbug.com/553264.
|
| - *target_format = kOverlayRenderFormat;
|
| gfx::Size pixmap_size = buffer_->GetSize();
|
| // If the required size is not integer-sized, round it to the next integer.
|
| *target_size = gfx::ToCeiledSize(
|
| gfx::SizeF(display_bounds.width() / crop_rect.width(),
|
| display_bounds.height() / crop_rect.height()));
|
|
|
| - return pixmap_size != *target_size || GetBufferFormat() != *target_format;
|
| + return pixmap_size != *target_size;
|
| }
|
|
|
| } // namespace ui
|
|
|