Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/gbm_surfaceless.cc |
| diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc |
| index 737a0664a6882d79458434c46a815c1e496c2275..7a9c9b516a728aa4afbf3a10bdb0e80efc8ac9bb 100644 |
| --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc |
| +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc |
| @@ -4,6 +4,7 @@ |
| #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" |
| +#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
| #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" |
| #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" |
| @@ -14,7 +15,9 @@ namespace ui { |
| GbmSurfaceless::GbmSurfaceless(scoped_ptr<DrmWindowProxy> window, |
| GbmSurfaceFactory* surface_manager) |
| - : window_(window.Pass()), surface_manager_(surface_manager) { |
| + : window_(window.Pass()), |
| + surface_manager_(surface_manager), |
| + weak_ptr_factory_(this) { |
| surface_manager_->RegisterSurface(window_->widget(), this); |
| } |
| @@ -26,6 +29,39 @@ void GbmSurfaceless::QueueOverlayPlane(const OverlayPlane& plane) { |
| planes_.push_back(plane); |
| } |
| +void GbmSurfaceless::EvaluateBufferConfiguration( |
| + const gfx::Rect& display_rect, |
| + const gfx::RectF& crop_rect, |
| + const gfx::Size& buffer_size, |
| + gfx::BufferFormat buffer_format, |
| + gfx::OverlayTransform transform, |
| + uint32_t z_order, |
| + gfx::Size* target_size, |
| + gfx::BufferFormat* target_format) { |
| + OverlayCheck_Params lookup; |
| + lookup.display_rect = display_rect; |
| + lookup.crop_rect = crop_rect; |
| + lookup.buffer_size = buffer_size; |
| + lookup.format = buffer_format; |
| + lookup.plane_z_order = z_order; |
| + lookup.transform = transform; |
| + |
| + std::vector<OverlayCheck_Params>::iterator it; |
| + it = std::find(overlay_params_.begin(), overlay_params_.end(), lookup); |
| + if (it != overlay_params_.end()) { |
| + *target_size = it->required_buffer_size; |
| + *target_format = it->optimal_format; |
| + } else { |
| + *target_size = buffer_size; |
| + *target_format = buffer_format; |
| + } |
| +} |
| + |
| +void GbmSurfaceless::GetOverlayBufferConfigurations( |
| + const std::vector<OverlayCheck_Params>& params) { |
| + overlay_params_ = params; |
| +} |
| + |
| intptr_t GbmSurfaceless::GetNativeWindow() { |
| NOTREACHED(); |
| return 0; |
| @@ -42,6 +78,10 @@ bool GbmSurfaceless::OnSwapBuffers() { |
| void GbmSurfaceless::OnSwapBuffersAsync( |
| const SwapCompletionCallback& callback) { |
| + window_->GetOverlayBufferConfigurations( |
|
kalyank
2015/11/19 16:10:41
I am still looking if we can pass target size and
|
| + base::Bind(&GbmSurfaceless::GetOverlayBufferConfigurations, |
| + weak_ptr_factory_.GetWeakPtr())); |
| + |
| window_->SchedulePageFlip(planes_, callback); |
| planes_.clear(); |
| } |