Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
| diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
| index e546bf2ed03c931898df1a4385ba2352788a56b9..311e67c84de794f1dfa252dd21167abff554d5d0 100644 |
| --- a/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
| +++ b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
| @@ -13,6 +13,7 @@ |
| #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
| #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| +#include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| namespace ui { |
| @@ -167,10 +168,12 @@ class DrmGpuPlatformSupportMessageFilter : public IPC::MessageFilter { |
| DrmGpuPlatformSupport::DrmGpuPlatformSupport( |
| DrmDeviceManager* drm_device_manager, |
| ScreenManager* screen_manager, |
| + ScanoutBufferGenerator* buffer_generator, |
| scoped_ptr<DrmGpuDisplayManager> display_manager) |
| : sender_(NULL), |
| drm_device_manager_(drm_device_manager), |
| screen_manager_(screen_manager), |
| + buffer_generator_(buffer_generator), |
| display_manager_(display_manager.Pass()) { |
| filter_ = new DrmGpuPlatformSupportMessageFilter( |
| screen_manager, base::Bind(&DrmGpuPlatformSupport::SetIOTaskRunner, |
| @@ -217,6 +220,8 @@ bool DrmGpuPlatformSupport::OnMessageReceived(const IPC::Message& message) { |
| IPC_MESSAGE_HANDLER(OzoneGpuMsg_GetHDCPState, OnGetHDCPState) |
| IPC_MESSAGE_HANDLER(OzoneGpuMsg_SetHDCPState, OnSetHDCPState) |
| IPC_MESSAGE_HANDLER(OzoneGpuMsg_SetGammaRamp, OnSetGammaRamp); |
| + IPC_MESSAGE_HANDLER(OzoneGpuMsg_CheckOverlayCapabilities, |
| + OnCheckOverlayCapabilities) |
| IPC_MESSAGE_UNHANDLED(handled = false); |
| IPC_END_MESSAGE_MAP() |
| @@ -260,6 +265,46 @@ void DrmGpuPlatformSupport::OnCursorMove(gfx::AcceleratedWidget widget, |
| screen_manager_->GetWindow(widget)->MoveCursor(location); |
| } |
| +void DrmGpuPlatformSupport::OnCheckOverlayCapabilities( |
| + gfx::AcceleratedWidget widget, |
| + const std::vector<OverlayCheck_Params>& overlays) { |
| + sender_->Send(new OzoneHostMsg_OverlayCapabilitiesReceived( |
| + widget, |
| + TestOverlayCapabilities(screen_manager_->GetWindow(widget), overlays))); |
| +} |
| + |
| +bool DrmGpuPlatformSupport::TestOverlayCapabilities( |
|
spang
2015/06/01 18:54:21
Feels misplaced here. This class wires up IPC, the
achaulk
2015/06/01 20:43:08
Sure
|
| + DrmWindow* window, |
| + const std::vector<OverlayCheck_Params>& overlays) { |
| + HardwareDisplayController* hdc = window->GetController(); |
| + if (!hdc) |
| + return false; |
| + scoped_refptr<DrmDevice> drm = hdc->GetAllocationDrmDevice(); |
| + |
| + OverlayPlaneList planes; |
| + for (const auto& overlay : overlays) { |
| + scoped_refptr<ScanoutBuffer> buffer; |
| + if (overlay.plane_z_order == 0) { |
| + buffer = buffer_generator_->Create(drm, window->bounds().size()); |
| + } else { |
| + // It is possible that the cc rect we get actually falls off the edge of |
| + // the screen. Usually this is prevented via things like status bars |
| + // blocking overlaying or cc clipping it, but in case it wasn't properly |
| + // clipped (since GL will render this situation fine) just ignore it here. |
| + // This should be an extremely rare occurrance. |
| + if (!window->bounds().Contains(overlay.display_rect)) |
| + return false; |
| + buffer = buffer_generator_->Create(drm, overlay.buffer_size); |
| + } |
| + if (!buffer) |
| + return false; |
| + planes.push_back(OverlayPlane(buffer, overlay.plane_z_order, |
| + overlay.transform, overlay.display_rect, |
| + gfx::RectF(gfx::Size(1, 1)))); |
| + } |
| + return window->TestPageFlip(planes); |
| +} |
| + |
| void DrmGpuPlatformSupport::OnRefreshNativeDisplays() { |
| sender_->Send( |
| new OzoneHostMsg_UpdateNativeDisplays(display_manager_->GetDisplays())); |