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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_window.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_ 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_ 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 10 matching lines...) Expand all
21 class SkBitmap; 21 class SkBitmap;
22 22
23 namespace gfx { 23 namespace gfx {
24 class Point; 24 class Point;
25 class Rect; 25 class Rect;
26 } // namespace gfx 26 } // namespace gfx
27 27
28 namespace ui { 28 namespace ui {
29 29
30 class DrmBuffer; 30 class DrmBuffer;
31 class DrmDevice;
31 class DrmDeviceManager; 32 class DrmDeviceManager;
32 class HardwareDisplayController; 33 class HardwareDisplayController;
33 struct OverlayCheck_Params; 34 struct OverlayCheck_Params;
34 class ScanoutBufferGenerator; 35 class ScanoutBufferGenerator;
35 class ScreenManager; 36 class ScreenManager;
36 37
37 // The GPU object representing a window. 38 // The GPU object representing a window.
38 // 39 //
39 // The main purpose of this object is to associate drawing surfaces with 40 // The main purpose of this object is to associate drawing surfaces with
40 // displays. A surface created with the same id as the window (from 41 // displays. A surface created with the same id as the window (from
41 // GetAcceleratedWidget()) will paint onto that window. A window with 42 // GetAcceleratedWidget()) will paint onto that window. A window with
42 // the same bounds as a display will paint onto that display. 43 // the same bounds as a display will paint onto that display.
43 // 44 //
44 // If there's no display whose bounds match the window's, the window is 45 // If there's no display whose bounds match the window's, the window is
45 // disconnected and its contents will not be visible to the user. 46 // disconnected and its contents will not be visible to the user.
46 class OZONE_EXPORT DrmWindow { 47 class OZONE_EXPORT DrmWindow : public base::SupportsWeakPtr<DrmWindow> {
47 public: 48 public:
48 DrmWindow(gfx::AcceleratedWidget widget, 49 DrmWindow(gfx::AcceleratedWidget widget,
49 DrmDeviceManager* device_manager, 50 DrmDeviceManager* device_manager,
50 ScreenManager* screen_manager); 51 ScreenManager* screen_manager);
51 52
52 ~DrmWindow(); 53 ~DrmWindow();
53 54
54 gfx::Rect bounds() const { return bounds_; } 55 gfx::Rect bounds() const { return bounds_; }
55 56
56 void Initialize(); 57 void Initialize();
57 58
58 void Shutdown(); 59 void Shutdown();
59 60
60 // Returns the accelerated widget associated with the window. 61 // Returns the accelerated widget associated with the window.
61 gfx::AcceleratedWidget GetAcceleratedWidget(); 62 gfx::AcceleratedWidget GetAcceleratedWidget();
62 63
63 // Returns the current controller the window is displaying on. Callers should 64 // Returns the current controller the window is displaying on. Callers should
64 // not cache the result as the controller may change as the window is moved. 65 // not cache the result as the controller may change as the window is moved.
65 HardwareDisplayController* GetController(); 66 HardwareDisplayController* GetController();
66 67
68 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const;
69
67 void SetController(HardwareDisplayController* controller); 70 void SetController(HardwareDisplayController* controller);
68 71
69 // Called when the window is resized/moved. 72 // Called when the window is resized/moved.
70 void OnBoundsChanged(const gfx::Rect& bounds); 73 void OnBoundsChanged(const gfx::Rect& bounds);
71 74
72 // Update the HW cursor bitmap & move to specified location. If 75 // Update the HW cursor bitmap & move to specified location. If
73 // the bitmap is empty, the cursor is hidden. 76 // the bitmap is empty, the cursor is hidden.
74 void SetCursor(const std::vector<SkBitmap>& bitmaps, 77 void SetCursor(const std::vector<SkBitmap>& bitmaps,
75 const gfx::Point& location, 78 const gfx::Point& location,
76 int frame_delay_ms); 79 int frame_delay_ms);
77 80
78 // Update the HW cursor bitmap & move to specified location. If 81 // Update the HW cursor bitmap & move to specified location. If
79 // the bitmap is empty, the cursor is hidden. 82 // the bitmap is empty, the cursor is hidden.
80 void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps, 83 void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
81 const gfx::Point& location); 84 const gfx::Point& location);
82 85
83 // Move the HW cursor to the specified location. 86 // Move the HW cursor to the specified location.
84 void MoveCursor(const gfx::Point& location); 87 void MoveCursor(const gfx::Point& location);
85 88
86 // Queue overlay planes and page flips. 89 // Queue overlay planes and page flips.
87 // If hardware display controller is available, forward the information 90 // If hardware display controller is available, forward the information
88 // immediately, otherwise queue up on the window and forward when the hardware 91 // immediately, otherwise queue up on the window and forward when the hardware
89 // is once again ready. 92 // is once again ready.
90 void QueueOverlayPlane(const OverlayPlane& plane); 93 void QueueOverlayPlane(const OverlayPlane& plane);
91 94
92 bool SchedulePageFlip(bool is_sync, const SwapCompletionCallback& callback); 95 void SchedulePageFlip(bool is_sync, const SwapCompletionCallback& callback);
93 bool TestPageFlip(const std::vector<OverlayCheck_Params>& planes, 96 bool TestPageFlip(const std::vector<OverlayCheck_Params>& planes,
94 ScanoutBufferGenerator* buffer_generator); 97 ScanoutBufferGenerator* buffer_generator);
95 98
96 // Returns the last buffer associated with this window. 99 // Returns the last buffer associated with this window.
97 const OverlayPlane* GetLastModesetBuffer(); 100 const OverlayPlane* GetLastModesetBuffer();
98 101
99 void GetVSyncParameters( 102 void GetVSyncParameters(
100 const gfx::VSyncProvider::UpdateVSyncCallback& callback) const; 103 const gfx::VSyncProvider::UpdateVSyncCallback& callback) const;
101 104
105 bool IsDisplayedOnUniversalDisplayLinkDevice() const;
106
102 private: 107 private:
103 // Draw the last set cursor & update the cursor plane. 108 // Draw the last set cursor & update the cursor plane.
104 void ResetCursor(bool bitmap_only); 109 void ResetCursor(bool bitmap_only);
105 110
106 // Draw next frame in an animated cursor. 111 // Draw next frame in an animated cursor.
107 void OnCursorAnimationTimeout(); 112 void OnCursorAnimationTimeout();
108 113
109 // When |controller_| changes this is called to reallocate the cursor buffers 114 // When |controller_| changes this is called to reallocate the cursor buffers
110 // since the allocation DRM device may have changed. 115 // since the allocation DRM device may have changed.
111 void UpdateCursorBuffers(); 116 void UpdateCursorBuffers();
(...skipping 25 matching lines...) Expand all
137 OverlayPlaneList pending_planes_; 142 OverlayPlaneList pending_planes_;
138 OverlayPlaneList last_submitted_planes_; 143 OverlayPlaneList last_submitted_planes_;
139 bool last_swap_sync_ = false; 144 bool last_swap_sync_ = false;
140 145
141 DISALLOW_COPY_AND_ASSIGN(DrmWindow); 146 DISALLOW_COPY_AND_ASSIGN(DrmWindow);
142 }; 147 };
143 148
144 } // namespace ui 149 } // namespace ui
145 150
146 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_ 151 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698