Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: ui/ozone/platform/drm/gpu/gbm_buffer.cc

Issue 1513283002: Add support to send optimal format as part of ScheduleOverlayPlane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update cmd_buffer_functions Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer.h ('k') | ui/ozone/platform/drm/host/drm_overlay_candidates_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer.h ('k') | ui/ozone/platform/drm/host/drm_overlay_candidates_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698