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

Unified Diff: ui/ozone/platform/drm/gpu/drm_thread.h

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: Created 5 years, 3 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: ui/ozone/platform/drm/gpu/drm_thread.h
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.h b/ui/ozone/platform/drm/gpu/drm_thread.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8fde25d1df24a7b85378f3929f6f635a5456085
--- /dev/null
+++ b/ui/ozone/platform/drm/gpu/drm_thread.h
@@ -0,0 +1,70 @@
+// 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.
+
+#ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_
+#define UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace ui {
+
+class DrmDeviceManager;
+class DrmGpuPlatformSupport;
+class DrmGpuPlatformSupportProxy;
+class DrmWindowProxy;
+class ScanoutBufferGenerator;
+class ScreenManager;
+
+// Holds all the DRM related state and performs all DRM related operations with
+// the exception of buffer allocations which happen on the threads requiring the
+// allocations.
+//
+// The DRM thread is used to insulate DRM operations from potential blocking
+// behaviour on the GPU main thread in order to reduce the potential for jank
+// (for example jank in the cursor if the GPU main thread is performing heavy
+// operations). The inverse is also true as blocking operations on the DRM
+// thread (such as modesetting) no longer block the GPU main thread.
+class DrmThread : public base::Thread {
+ public:
+ DrmThread();
+ ~DrmThread() override;
+
+ void Start();
+
+ // Safe to use from any thread. Access to the device manager is direct since
+ // the device manager performs its own locking since buffer allocations need
+ // to happen on the main GPU thread and on the IO GPU thread without waiting.
+ DrmDeviceManager* device_manager() const { return device_manager_.get(); }
+
+ // Safe to use from any thread.
+ scoped_ptr<DrmWindowProxy> CreateWindowProxy(
+ gfx::AcceleratedWidget widget) const;
+
+ // Safe to use from any thread.
+ scoped_ptr<DrmGpuPlatformSupportProxy> CreateGpuPlatformSupportProxy() const;
+
+ // base::Thread:
+ void Init() override;
+
+ protected:
+ scoped_ptr<DrmDeviceManager> device_manager_;
+ scoped_ptr<ScanoutBufferGenerator> buffer_generator_;
+ scoped_ptr<ScreenManager> screen_manager_;
+ scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_;
+
+ private:
+ void CreateWindowProxyOnThread(gfx::AcceleratedWidget widget,
+ scoped_ptr<DrmWindowProxy>* proxy) const;
+
+ void CreateGpuPlatformSupportProxyOnThread(
+ scoped_ptr<DrmGpuPlatformSupportProxy>* proxy) const;
+
+ DISALLOW_COPY_AND_ASSIGN(DrmThread);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_

Powered by Google App Engine
This is Rietveld 408576698