| 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 2e269bfebe87b6784f5c936b3b0a4c5b5553fa9d..9e36f309c8391175c36f0e308f4437deb3119013 100644
|
| --- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| +++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| @@ -20,11 +20,6 @@
|
| #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h"
|
| #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.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,
|
| @@ -134,17 +129,23 @@ bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| gfx::OverlayTransform plane_transform,
|
| 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;
|
| + GbmSurfaceless* surface = surface_manager_->GetSurface(widget);
|
| + if (plane_z_order) {
|
| + gfx::Size target_size;
|
| + gfx::BufferFormat target_format;
|
| + gfx::BufferFormat format = GetBufferFormat();
|
| + surface->EvaluateBufferConfiguration(
|
| + display_bounds, crop_rect, buffer_->GetSize(), format, plane_transform,
|
| + plane_z_order, &target_size, &target_format);
|
| + if (target_size != buffer_->GetSize() || format != 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;
|
| + }
|
| }
|
| }
|
|
|
| @@ -155,35 +156,9 @@ bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| }
|
|
|
| DCHECK(buffer_->GetUsage() == gfx::BufferUsage::SCANOUT);
|
| - surface_manager_->GetSurface(widget)->QueueOverlayPlane(OverlayPlane(
|
| + surface->QueueOverlayPlane(OverlayPlane(
|
| buffer_, plane_z_order, plane_transform, display_bounds, crop_rect));
|
| return true;
|
| }
|
|
|
| -bool GbmPixmap::ShouldApplyProcessing(const gfx::Rect& display_bounds,
|
| - const gfx::RectF& crop_rect,
|
| - gfx::Size* target_size,
|
| - gfx::BufferFormat* target_format) {
|
| - if (crop_rect.width() == 0 || crop_rect.height() == 0) {
|
| - PLOG(ERROR) << "ShouldApplyProcessing passed zero processing target.";
|
| - return false;
|
| - }
|
| -
|
| - if (!buffer_) {
|
| - PLOG(ERROR) << "ShouldApplyProcessing requires a buffer.";
|
| - 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;
|
| -}
|
| -
|
| } // namespace ui
|
|
|