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

Unified Diff: ui/ozone/platform/drm/host/drm_native_display_delegate.h

Issue 1072193008: [1/4][Ozone-Drm] Process display hotplug events sequentially (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add task_pending_ Created 5 years, 8 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 | « no previous file | ui/ozone/platform/drm/host/drm_native_display_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/host/drm_native_display_delegate.h
diff --git a/ui/ozone/platform/drm/host/drm_native_display_delegate.h b/ui/ozone/platform/drm/host/drm_native_display_delegate.h
index d28ea68d346763812299f5a8e7237a88f07be747..f6269bcd96db958affcf3e1f60c46d4befe03014 100644
--- a/ui/ozone/platform/drm/host/drm_native_display_delegate.h
+++ b/ui/ozone/platform/drm/host/drm_native_display_delegate.h
@@ -6,13 +6,17 @@
#define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_
#include <map>
+#include <queue>
+#include <set>
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "ui/display/types/native_display_delegate.h"
+#include "ui/events/ozone/device/device_event.h"
#include "ui/events/ozone/device/device_event_observer.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
@@ -76,11 +80,26 @@ class DrmNativeDisplayDelegate : public NativeDisplayDelegate,
bool OnMessageReceived(const IPC::Message& message) override;
private:
+ struct DisplayEvent {
+ DisplayEvent(DeviceEvent::ActionType action_type,
+ const base::FilePath& path)
+ : action_type(action_type), path(path) {}
+
+ DeviceEvent::ActionType action_type;
+ base::FilePath path;
+ };
+
void OnUpdateNativeDisplays(
const std::vector<DisplaySnapshot_Params>& displays);
void OnDisplayConfigured(int64_t display_id, bool status);
- void OnNewGraphicsDevice(const base::FilePath& path, base::File file);
+ void ProcessEvent();
+
+ // Called as a result of finishing to process the display hotplug event. These
+ // are responsible for dequing the event and scheduling the next event.
+ void OnAddGraphicsDevice(const base::FilePath& path, base::File file);
+ void OnUpdateGraphicsDevice();
+ void OnRemoveGraphicsDevice(const base::FilePath& path);
void OnHDCPStateReceived(int64_t display_id, bool status, HDCPState state);
void OnHDCPStateUpdated(int64_t display_id, bool status);
@@ -112,6 +131,18 @@ class DrmNativeDisplayDelegate : public NativeDisplayDelegate,
std::map<int64_t, SetHDCPStateCallback> set_hdcp_state_callback_map_;
+ // Used to serialize display event processing. This is done since
+ // opening/closing DRM devices cannot be done on the UI thread and are handled
+ // on a worker thread. Thus, we need to queue events in order to process them
+ // in the correct order.
+ std::queue<DisplayEvent> event_queue_;
+
+ // True if a display event is currently being processed on a worker thread.
+ bool task_pending_;
+
+ // Keeps track of all the active DRM devices.
+ std::set<base::FilePath> drm_devices_;
+
base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate);
« no previous file with comments | « no previous file | ui/ozone/platform/drm/host/drm_native_display_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698