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
3 // found in the LICENSE file.
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
11 #include "ipc/message_filter.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/ozone/platform/dri/dri_helper_thread.h"
14 #include "ui/ozone/public/gpu_platform_support.h"
29 class DriSurfaceFactory
;
30 class DriWindowDelegate
;
31 class DriWindowDelegateManager
;
33 class NativeDisplayDelegateDri
;
36 struct DisplayMode_Params
;
37 struct DisplaySnapshot_Params
;
39 class DriGpuPlatformSupport
: public GpuPlatformSupport
{
41 DriGpuPlatformSupport(DriWrapper
* drm
,
42 DriWindowDelegateManager
* window_manager
,
43 ScreenManager
* screen_manager
,
44 scoped_ptr
<NativeDisplayDelegateDri
> ndd
);
45 ~DriGpuPlatformSupport() override
;
47 void AddHandler(scoped_ptr
<GpuPlatformSupport
> handler
);
49 // GpuPlatformSupport:
50 void OnChannelEstablished(IPC::Sender
* sender
) override
;
51 void RelinquishGpuResources(const base::Closure
& callback
) override
;
52 IPC::MessageFilter
* GetMessageFilter() override
;
55 bool OnMessageReceived(const IPC::Message
& message
) override
;
58 void OnCreateWindowDelegate(gfx::AcceleratedWidget widget
);
59 void OnDestroyWindowDelegate(gfx::AcceleratedWidget widget
);
60 void OnWindowBoundsChanged(gfx::AcceleratedWidget widget
,
61 const gfx::Rect
& bounds
);
62 void OnCursorSet(gfx::AcceleratedWidget widget
,
63 const std::vector
<SkBitmap
>& bitmaps
,
64 const gfx::Point
& location
,
66 void OnCursorMove(gfx::AcceleratedWidget widget
, const gfx::Point
& location
);
68 // Display related IPC handlers.
70 void OnRefreshNativeDisplays();
71 void OnConfigureNativeDisplay(int64_t id
,
72 const DisplayMode_Params
& mode
,
73 const gfx::Point
& origin
);
74 void OnDisableNativeDisplay(int64_t id
);
75 void OnTakeDisplayControl();
76 void OnRelinquishDisplayControl();
77 void OnAddGraphicsDevice(const base::FilePath
& path
);
78 void OnRemoveGraphicsDevice(const base::FilePath
& path
);
82 IPC::Sender
* sender_
; // Not owned.
83 DriWrapper
* drm_
; // Not owned.
84 DriWindowDelegateManager
* window_manager_
; // Not owned.
85 ScreenManager
* screen_manager_
; // Not owned.
87 DriHelperThread helper_thread_
;
88 scoped_ptr
<NativeDisplayDelegateDri
> ndd_
;
89 ScopedVector
<GpuPlatformSupport
> handlers_
;
90 scoped_refptr
<IPC::MessageFilter
> filter_
;
95 #endif // UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_