OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/file_descriptor_posix.h" |
| 6 #include "base/files/file_path.h" |
| 7 #include "base/logging.h" |
| 8 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 9 #include "mojo/converters/ozone_drm_gpu/ozone_drm_gpu_type_converters.h" |
| 10 #include "services/native_viewport/ozone/ozone_drm_gpu_impl.h" |
| 11 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
| 12 #include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h" |
| 13 #include "ui/ozone/public/ozone_platform.h" |
| 14 |
| 15 namespace native_viewport { |
| 16 |
| 17 OzoneDrmGpuImpl::OzoneDrmGpuImpl( |
| 18 mojo::InterfaceRequest<mojo::OzoneDrmGpu> request, |
| 19 const mojo::OzoneDrmHostPtr& ozone_drm_host) |
| 20 : binding_(this, request.Pass()), ozone_drm_host_(ozone_drm_host) { |
| 21 ui::OzonePlatform::InitializeForGPU(); |
| 22 |
| 23 platform_support_ = static_cast<ui::DrmGpuPlatformSupport*>( |
| 24 ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport()); |
| 25 |
| 26 platform_support_->SetDelegate(this); |
| 27 platform_support_->OnChannelEstablished(); |
| 28 } |
| 29 |
| 30 OzoneDrmGpuImpl::~OzoneDrmGpuImpl() {} |
| 31 |
| 32 void OzoneDrmGpuImpl::CreateWindow(int64_t widget) { |
| 33 platform_support_->OnCreateWindow(widget); |
| 34 } |
| 35 |
| 36 void OzoneDrmGpuImpl::WindowBoundsChanged(int64_t widget, |
| 37 mojo::RectPtr bounds) { |
| 38 platform_support_->OnWindowBoundsChanged(widget, bounds.To<gfx::Rect>()); |
| 39 } |
| 40 |
| 41 void OzoneDrmGpuImpl::AddGraphicsDevice(const mojo::String& file_path, |
| 42 int32_t file_descriptor) { |
| 43 platform_support_->OnAddGraphicsDevice( |
| 44 base::FilePath(file_path.get()), |
| 45 base::FileDescriptor(file_descriptor, false)); |
| 46 } |
| 47 |
| 48 void OzoneDrmGpuImpl::RefreshNativeDisplays() { |
| 49 platform_support_->OnRefreshNativeDisplays(); |
| 50 } |
| 51 |
| 52 void OzoneDrmGpuImpl::ConfigureNativeDisplay(int64_t id, |
| 53 mojo::DisplayModePtr mode, |
| 54 mojo::PointPtr originhost) { |
| 55 platform_support_->OnConfigureNativeDisplay( |
| 56 id, mode.To<ui::DisplayMode_Params>(), originhost.To<gfx::Point>()); |
| 57 } |
| 58 |
| 59 void OzoneDrmGpuImpl::UpdateNativeDisplays( |
| 60 const std::vector<ui::DisplaySnapshot_Params>& displays) { |
| 61 ozone_drm_host_->UpdateNativeDisplays( |
| 62 mojo::Array<mojo::DisplaySnapshotPtr>::From(displays)); |
| 63 } |
| 64 |
| 65 void OzoneDrmGpuImpl::DisplayConfigured(int64_t id, bool result) { |
| 66 ozone_drm_host_->DisplayConfigured(id, result); |
| 67 } |
| 68 |
| 69 } // namespace |
OLD | NEW |