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

Side by Side Diff: ui/ozone/platform/dri/dri_window_delegate.h

Issue 981583005: [Ozone-Dri] Merge the DriWindowDelegate with the implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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_DRI_DRI_WINDOW_DELEGATE_H_ 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_H_ 6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/timer/timer.h"
11 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/ozone/ozone_export.h"
15 #include "ui/ozone/platform/dri/display_change_observer.h"
11 16
12 class SkBitmap; 17 class SkBitmap;
13 18
14 namespace gfx { 19 namespace gfx {
15 class Point; 20 class Point;
16 class Rect; 21 class Rect;
17 } // namespace gfx 22 } // namespace gfx
18 23
19 namespace ui { 24 namespace ui {
20 25
26 class DriBuffer;
27 class DrmDeviceManager;
21 class HardwareDisplayController; 28 class HardwareDisplayController;
29 class ScreenManager;
22 30
23 // Interface for the display-server half of a DriWindow. 31 // A delegate of the platform window (DriWindow) on the GPU process. This is
24 // 32 // used to keep track of window state changes such that each platform window is
25 // The main implementation of this lives in the process that owns the display 33 // correctly associated with a display.
26 // connection (usually the GPU process) and associates a platform window 34 // A window is associated with the display whose bounds contains the window
27 // (DriWindow) with a display. A window is associated with the display whose 35 // bounds. If there's no suitable display, the window is disconnected and its
28 // bounds contains the window bounds. If there's no suitable display, the window 36 // contents will not be visible.
29 // is disconnected and its contents will not be visible. 37 class OZONE_EXPORT DriWindowDelegate : public DisplayChangeObserver {
30 //
31 // In software mode, this is owned directly on DriWindow because the display
32 // controller object is in the same process.
33 //
34 // In accelerated mode, there's a proxy implementation and calls are forwarded
35 // to the real object in the GPU process via IPC.
36 class DriWindowDelegate {
37 public: 38 public:
38 virtual ~DriWindowDelegate() {} 39 DriWindowDelegate(gfx::AcceleratedWidget widget,
40 DrmDeviceManager* device_manager,
41 ScreenManager* screen_manager);
39 42
40 virtual void Initialize() = 0; 43 ~DriWindowDelegate() override;
41 44
42 virtual void Shutdown() = 0; 45 void Initialize();
46
47 void Shutdown();
43 48
44 // Returns the accelerated widget associated with the delegate. 49 // Returns the accelerated widget associated with the delegate.
45 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; 50 gfx::AcceleratedWidget GetAcceleratedWidget();
46 51
47 // Returns the current controller the window is displaying on. Callers should 52 // Returns the current controller the window is displaying on. Callers should
48 // not cache the result as the controller may change as the window is moved. 53 // not cache the result as the controller may change as the window is moved.
49 virtual HardwareDisplayController* GetController() = 0; 54 HardwareDisplayController* GetController();
50 55
51 // Called when the window is resized/moved. 56 // Called when the window is resized/moved.
52 virtual void OnBoundsChanged(const gfx::Rect& bounds) = 0; 57 void OnBoundsChanged(const gfx::Rect& bounds);
53 58
54 // Update the HW cursor bitmap & move to specified location. If 59 // Update the HW cursor bitmap & move to specified location. If
55 // the bitmap is empty, the cursor is hidden. 60 // the bitmap is empty, the cursor is hidden.
56 virtual void SetCursor(const std::vector<SkBitmap>& bitmaps, 61 void SetCursor(const std::vector<SkBitmap>& bitmaps,
57 const gfx::Point& location, 62 const gfx::Point& location,
58 int frame_delay_ms) = 0; 63 int frame_delay_ms);
59 64
60 // Update the HW cursor bitmap & move to specified location. If 65 // Update the HW cursor bitmap & move to specified location. If
61 // the bitmap is empty, the cursor is hidden. 66 // the bitmap is empty, the cursor is hidden.
62 virtual void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps, 67 void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
63 const gfx::Point& location) = 0; 68 const gfx::Point& location);
64 69
65 // Move the HW cursor to the specified location. 70 // Move the HW cursor to the specified location.
66 virtual void MoveCursor(const gfx::Point& location) = 0; 71 void MoveCursor(const gfx::Point& location);
72
73 // DisplayChangeObserver:
74 void OnDisplayChanged(HardwareDisplayController* controller) override;
75 void OnDisplayRemoved(HardwareDisplayController* controller) override;
76
77 private:
78 // Draw the last set cursor & update the cursor plane.
79 void ResetCursor(bool bitmap_only);
80
81 // Draw next frame in an animated cursor.
82 void OnCursorAnimationTimeout();
83
84 void UpdateWidgetToDrmDeviceMapping();
85
86 // When |controller_| changes this is called to reallocate the cursor buffers
87 // since the allocation DRM device may have changed.
88 void UpdateCursorBuffers();
89
90 gfx::AcceleratedWidget widget_;
91
92 DrmDeviceManager* device_manager_; // Not owned.
93 ScreenManager* screen_manager_; // Not owned.
94
95 // The current bounds of the window.
96 gfx::Rect bounds_;
97
98 // The controller associated with the current window. This may be nullptr if
99 // the window isn't over an active display.
100 HardwareDisplayController* controller_;
101
102 base::RepeatingTimer<DriWindowDelegate> cursor_timer_;
103
104 scoped_refptr<DriBuffer> cursor_buffers_[2];
105 int cursor_frontbuffer_;
106
107 std::vector<SkBitmap> cursor_bitmaps_;
108 gfx::Point cursor_location_;
109 int cursor_frame_;
110 int cursor_frame_delay_ms_;
111
112 DISALLOW_COPY_AND_ASSIGN(DriWindowDelegate);
67 }; 113 };
68 114
69 } // namespace ui 115 } // namespace ui
70 116
71 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_H_ 117 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_surface_unittest.cc ('k') | ui/ozone/platform/dri/dri_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698