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

Unified Diff: services/native_viewport/ozone/ozone_drm_gpu_impl.cc

Issue 1309273005: native_viewport support for ozone (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 4 months 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
Index: services/native_viewport/ozone/ozone_drm_gpu_impl.cc
diff --git a/services/native_viewport/ozone/ozone_drm_gpu_impl.cc b/services/native_viewport/ozone/ozone_drm_gpu_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7eb5730ce45234f497f02279ab0d33df2ab84f58
--- /dev/null
+++ b/services/native_viewport/ozone/ozone_drm_gpu_impl.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/file_descriptor_posix.h"
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "mojo/converters/geometry/geometry_type_converters.h"
+#include "mojo/converters/ozone_drm_gpu/ozone_drm_gpu_type_converters.h"
+#include "services/native_viewport/ozone/ozone_drm_gpu_impl.h"
+#include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h"
+#include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h"
+#include "ui/ozone/public/ozone_platform.h"
+
+namespace native_viewport {
+
+OzoneDrmGpuImpl::OzoneDrmGpuImpl(
+ mojo::InterfaceRequest<mojo::OzoneDrmGpu> request,
+ const mojo::OzoneDrmHostPtr& ozone_drm_host)
+ : binding_(this, request.Pass()), ozone_drm_host_(ozone_drm_host) {
+ ui::OzonePlatform::InitializeForGPU();
+
+ platform_support_ = static_cast<ui::DrmGpuPlatformSupport*>(
+ ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport());
+
+ platform_support_->SetDelegate(this);
+ platform_support_->OnChannelEstablished();
+}
+
+OzoneDrmGpuImpl::~OzoneDrmGpuImpl() {}
+
+void OzoneDrmGpuImpl::CreateWindow(int64_t widget) {
+ platform_support_->OnCreateWindow(widget);
+}
+
+void OzoneDrmGpuImpl::WindowBoundsChanged(int64_t widget,
+ mojo::RectPtr bounds) {
+ platform_support_->OnWindowBoundsChanged(widget, bounds.To<gfx::Rect>());
+}
+
+void OzoneDrmGpuImpl::AddGraphicsDevice(const mojo::String& file_path,
+ int32_t file_descriptor) {
+ platform_support_->OnAddGraphicsDevice(
+ base::FilePath(file_path.get()),
+ base::FileDescriptor(file_descriptor, false));
+}
+
+void OzoneDrmGpuImpl::RefreshNativeDisplays() {
+ platform_support_->OnRefreshNativeDisplays();
+}
+
+void OzoneDrmGpuImpl::ConfigureNativeDisplay(int64_t id,
+ mojo::DisplayModePtr mode,
+ mojo::PointPtr originhost) {
+ platform_support_->OnConfigureNativeDisplay(
+ id, mode.To<ui::DisplayMode_Params>(), originhost.To<gfx::Point>());
+}
+
+void OzoneDrmGpuImpl::UpdateNativeDisplays(
+ const std::vector<ui::DisplaySnapshot_Params>& displays) {
+ ozone_drm_host_->UpdateNativeDisplays(
+ mojo::Array<mojo::DisplaySnapshotPtr>::From(displays));
+}
+
+void OzoneDrmGpuImpl::DisplayConfigured(int64_t id, bool result) {
+ ozone_drm_host_->DisplayConfigured(id, result);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698