summaryrefslogtreecommitdiffstats
path: root/ui/ozone/platform/drm/gpu/drm_window.h
diff options
context:
space:
mode:
authordnicoara <dnicoara@chromium.org>2015-03-05 12:46:18 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-05 20:47:08 +0000
commit171d8c892da1b2e38f90c17b62896ba82f0719e3 (patch)
tree9fe2810948b2d8dfd73cd7a5afa002dcf79c0547 /ui/ozone/platform/drm/gpu/drm_window.h
parentf36607f2398cb4aa9b50449b1221bbc72e3f3453 (diff)
downloadchromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.zip
chromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.tar.gz
chromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.tar.bz2
[Ozone] Rename and split the DRI platform for clarity
This CL does the following: - Moves the files in ui/ozone/platform/dri to ui/ozone/platform/drm since the platform name should really be DRM rather than DRI. Note, that the platform is still refered to as "dri" in GYP/GN since CrOS builds are still using the 'dri' name. - Rename all files with a "_dri*" suffix to a "drm_" prefix. Also rename all files with a "dri_" prefix to a "drm_" prefix. - Rename NativeDisplayDelegateDri to DrmDisplayDelegateManager since it is no longer dependent on the NativeDisplayDelegate interface and the new name better describes its intent. - Split the files in the platform into 2 sub-folders ("host" and "gpu"). Depending on the intended use place of the objects (Browser (host) process or GPU process) the files in the platform are split accordingly in the 2 sub-folders. BUG=none TBR=jam@chromium.org Review URL: https://codereview.chromium.org/975063002 Cr-Commit-Position: refs/heads/master@{#319320}
Diffstat (limited to 'ui/ozone/platform/drm/gpu/drm_window.h')
-rw-r--r--ui/ozone/platform/drm/gpu/drm_window.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/ui/ozone/platform/drm/gpu/drm_window.h b/ui/ozone/platform/drm/gpu/drm_window.h
new file mode 100644
index 0000000..aa01ae9
--- /dev/null
+++ b/ui/ozone/platform/drm/gpu/drm_window.h
@@ -0,0 +1,117 @@
+// Copyright 2014 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_WINDOW_H_
+#define UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_
+
+#include <vector>
+
+#include "base/timer/timer.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/ozone/ozone_export.h"
+#include "ui/ozone/platform/drm/gpu/display_change_observer.h"
+
+class SkBitmap;
+
+namespace gfx {
+class Point;
+class Rect;
+} // namespace gfx
+
+namespace ui {
+
+class DrmBuffer;
+class DrmDeviceManager;
+class HardwareDisplayController;
+class ScreenManager;
+
+// A delegate of the platform window (DrmWindow) on the GPU process. This is
+// used to keep track of window state changes such that each platform window is
+// correctly associated with a display.
+// A window is associated with the display whose bounds contains the window
+// bounds. If there's no suitable display, the window is disconnected and its
+// contents will not be visible.
+class OZONE_EXPORT DrmWindow : public DisplayChangeObserver {
+ public:
+ DrmWindow(gfx::AcceleratedWidget widget,
+ DrmDeviceManager* device_manager,
+ ScreenManager* screen_manager);
+
+ ~DrmWindow() override;
+
+ void Initialize();
+
+ void Shutdown();
+
+ // Returns the accelerated widget associated with the delegate.
+ gfx::AcceleratedWidget GetAcceleratedWidget();
+
+ // Returns the current controller the window is displaying on. Callers should
+ // not cache the result as the controller may change as the window is moved.
+ HardwareDisplayController* GetController();
+
+ // Called when the window is resized/moved.
+ void OnBoundsChanged(const gfx::Rect& bounds);
+
+ // Update the HW cursor bitmap & move to specified location. If
+ // the bitmap is empty, the cursor is hidden.
+ void SetCursor(const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& location,
+ int frame_delay_ms);
+
+ // Update the HW cursor bitmap & move to specified location. If
+ // the bitmap is empty, the cursor is hidden.
+ void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& location);
+
+ // Move the HW cursor to the specified location.
+ void MoveCursor(const gfx::Point& location);
+
+ // DisplayChangeObserver:
+ void OnDisplayChanged(HardwareDisplayController* controller) override;
+ void OnDisplayRemoved(HardwareDisplayController* controller) override;
+
+ private:
+ // Draw the last set cursor & update the cursor plane.
+ void ResetCursor(bool bitmap_only);
+
+ // Draw next frame in an animated cursor.
+ void OnCursorAnimationTimeout();
+
+ void UpdateWidgetToDrmDeviceMapping();
+
+ // When |controller_| changes this is called to reallocate the cursor buffers
+ // since the allocation DRM device may have changed.
+ void UpdateCursorBuffers();
+
+ gfx::AcceleratedWidget widget_;
+
+ DrmDeviceManager* device_manager_; // Not owned.
+ ScreenManager* screen_manager_; // Not owned.
+
+ // The current bounds of the window.
+ gfx::Rect bounds_;
+
+ // The controller associated with the current window. This may be nullptr if
+ // the window isn't over an active display.
+ HardwareDisplayController* controller_;
+
+ base::RepeatingTimer<DrmWindow> cursor_timer_;
+
+ scoped_refptr<DrmBuffer> cursor_buffers_[2];
+ int cursor_frontbuffer_;
+
+ std::vector<SkBitmap> cursor_bitmaps_;
+ gfx::Point cursor_location_;
+ int cursor_frame_;
+ int cursor_frame_delay_ms_;
+
+ DISALLOW_COPY_AND_ASSIGN(DrmWindow);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_WINDOW_H_