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

Unified Diff: ui/ozone/platform/drm/mus_thread_proxy.h

Issue 1831693002: In-mus ozone drm platform implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more review comments Created 4 years, 9 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
« no previous file with comments | « ui/ozone/platform/drm/gbm.gypi ('k') | ui/ozone/platform/drm/mus_thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/mus_thread_proxy.h
diff --git a/ui/ozone/platform/drm/mus_thread_proxy.h b/ui/ozone/platform/drm/mus_thread_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..98bf7e81be85458f2ecac7910013e531fc0f01ef
--- /dev/null
+++ b/ui/ozone/platform/drm/mus_thread_proxy.h
@@ -0,0 +1,138 @@
+// Copyright 2016 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.
+
+#ifndef UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
+#define UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
+#include "base/synchronization/lock.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/ozone/platform/drm/gpu/inter_thread_messaging_proxy.h"
+#include "ui/ozone/platform/drm/host/drm_cursor.h"
+#include "ui/ozone/platform/drm/host/gpu_thread_adapter.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace ui {
+
+class DrmCursor;
+class DrmDisplayHostManager;
+class DrmOverlayManager;
+class DrmThread;
+class GpuThreadObserver;
+
+// In Mus, the window server thread (analogous to Chrome's UI thread), GPU and
+// DRM threads coexist in a single Mus process. The |MusThreadProxy| connects
+// these threads together via cross-thread calls.
+class MusThreadProxy : public GpuThreadAdapter,
+ public InterThreadMessagingProxy,
+ public DrmCursorProxy {
+ public:
+ MusThreadProxy();
+ ~MusThreadProxy() override;
+
+ void StartDrmThread();
+ void ProvideManagers(DrmDisplayHostManager* display_manager,
+ DrmOverlayManager* overlay_manager);
+
+ // InterThreadMessagingProxy.
+ void SetDrmThread(DrmThread* thread) override;
+
+ // This is the core functionality. They are invoked when we have a main
+ // thread, a gpu thread and we have called initialize on both.
+ void AddGpuThreadObserver(GpuThreadObserver* observer) override;
+ void RemoveGpuThreadObserver(GpuThreadObserver* observer) override;
+ bool IsConnected() override;
+
+ // Services needed for DrmDisplayHostMananger.
+ void RegisterHandlerForDrmDisplayHostManager(
+ DrmDisplayHostManager* handler) override;
+ void UnRegisterHandlerForDrmDisplayHostManager() override;
+
+ bool GpuTakeDisplayControl() override;
+ bool GpuRefreshNativeDisplays() override;
+ bool GpuRelinquishDisplayControl() override;
+ bool GpuAddGraphicsDevice(const base::FilePath& path,
+ const base::FileDescriptor& fd) override;
+ bool GpuRemoveGraphicsDevice(const base::FilePath& path) override;
+
+ // Services needed for DrmOverlayManager.
+ void RegisterHandlerForDrmOverlayManager(DrmOverlayManager* handler) override;
+ void UnRegisterHandlerForDrmOverlayManager() override;
+
+ bool GpuCheckOverlayCapabilities(
+ gfx::AcceleratedWidget widget,
+ const std::vector<OverlayCheck_Params>& new_params) override;
+
+ // Services needed by DrmDisplayHost
+ bool GpuConfigureNativeDisplay(int64_t display_id,
+ const ui::DisplayMode_Params& display_mode,
+ const gfx::Point& point) override;
+ bool GpuDisableNativeDisplay(int64_t display_id) override;
+ bool GpuGetHDCPState(int64_t display_id) override;
+ bool GpuSetHDCPState(int64_t display_id, ui::HDCPState state) override;
+ bool GpuSetGammaRamp(int64_t display_id,
+ const std::vector<GammaRampRGBEntry>& lut) override;
+
+ // Services needed by DrmWindowHost
+ bool GpuDestroyWindow(gfx::AcceleratedWidget widget) override;
+ bool GpuCreateWindow(gfx::AcceleratedWidget widget) override;
+ bool GpuWindowBoundsChanged(gfx::AcceleratedWidget widget,
+ const gfx::Rect& bounds) override;
+
+ // DrmCursorProxy.
+ void CursorSet(gfx::AcceleratedWidget window,
+ const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& point,
+ int frame_delay_ms) override;
+ void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override;
+
+ private:
+ void RunObservers();
+ void DispatchObserversFromDrmThread();
+
+ void GpuCheckOverlayCapabilitiesCallback(
+ gfx::AcceleratedWidget widget,
+ const std::vector<OverlayCheck_Params>& overlays) const;
+
+ void GpuConfigureNativeDisplayCallback(int64_t display_id,
+ bool success) const;
+
+ void GpuRefreshNativeDisplaysCallback(
+ const std::vector<DisplaySnapshot_Params>& displays) const;
+ void GpuDisableNativeDisplayCallback(int64_t display_id, bool success) const;
+ void GpuTakeDisplayControlCallback(bool success) const;
+ void GpuRelinquishDisplayControlCallback(bool success) const;
+ void GpuGetHDCPStateCallback(int64_t display_id,
+ bool success,
+ HDCPState state) const;
+ void GpuSetHDCPStateCallback(int64_t display_id, bool success) const;
+
+ scoped_refptr<base::SingleThreadTaskRunner> ws_task_runner_;
+
+ DrmThread* drm_thread_; // Not owned.
+
+ // Guards for multi-theaded access to drm_thread_.
+ base::Lock lock_;
+
+ DrmDisplayHostManager* display_manager_; // Not owned.
+ DrmOverlayManager* overlay_manager_; // Not owned.
+
+ base::ObserverList<GpuThreadObserver> gpu_thread_observers_;
+
+ base::ThreadChecker on_window_server_thread_;
+
+ base::WeakPtrFactory<MusThreadProxy> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MusThreadProxy);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_DRM_MUS_THREAD_PROXY_H_
« no previous file with comments | « ui/ozone/platform/drm/gbm.gypi ('k') | ui/ozone/platform/drm/mus_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698