OLD | NEW |
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_GBM_SURFACELESS_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "ui/gfx/buffer_types.h" |
10 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | 13 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
12 #include "ui/ozone/public/surface_ozone_egl.h" | 14 #include "ui/ozone/public/surface_ozone_egl.h" |
13 | 15 |
14 namespace gfx { | 16 namespace gfx { |
15 class Size; | 17 class Size; |
16 } | 18 } |
17 | 19 |
18 namespace ui { | 20 namespace ui { |
19 | 21 |
20 class DrmWindowProxy; | 22 class DrmWindowProxy; |
21 class GbmSurfaceFactory; | 23 class GbmSurfaceFactory; |
| 24 struct OverlayCheck_Params; |
22 | 25 |
23 // In surfaceless mode drawing and displaying happens directly through | 26 // In surfaceless mode drawing and displaying happens directly through |
24 // NativePixmap buffers. CC would call into SurfaceFactoryOzone to allocate the | 27 // NativePixmap buffers. CC would call into SurfaceFactoryOzone to allocate the |
25 // buffers and then call ScheduleOverlayPlane(..) to schedule the buffer for | 28 // buffers and then call ScheduleOverlayPlane(..) to schedule the buffer for |
26 // presentation. | 29 // presentation. |
27 class GbmSurfaceless : public SurfaceOzoneEGL { | 30 class GbmSurfaceless : public SurfaceOzoneEGL { |
28 public: | 31 public: |
29 GbmSurfaceless(scoped_ptr<DrmWindowProxy> window, | 32 GbmSurfaceless(scoped_ptr<DrmWindowProxy> window, |
30 GbmSurfaceFactory* surface_manager); | 33 GbmSurfaceFactory* surface_manager); |
31 ~GbmSurfaceless() override; | 34 ~GbmSurfaceless() override; |
32 | 35 |
33 void QueueOverlayPlane(const OverlayPlane& plane); | 36 void QueueOverlayPlane(const OverlayPlane& plane); |
34 | 37 |
| 38 // Returns optimal buffer configuration which can be supported by the display |
| 39 // on which |window_| is shown. |
| 40 void EvaluateBufferConfiguration(const gfx::Rect& display_rect, |
| 41 const gfx::RectF& crop_rect, |
| 42 const gfx::Size& buffer_size, |
| 43 gfx::BufferFormat buffer_format, |
| 44 gfx::OverlayTransform transform, |
| 45 uint32_t z_order, |
| 46 gfx::Size* target_size, |
| 47 gfx::BufferFormat* target_format); |
| 48 |
| 49 void GetOverlayBufferConfigurations( |
| 50 const std::vector<OverlayCheck_Params>& params); |
35 // SurfaceOzoneEGL: | 51 // SurfaceOzoneEGL: |
36 intptr_t GetNativeWindow() override; | 52 intptr_t GetNativeWindow() override; |
37 bool ResizeNativeWindow(const gfx::Size& viewport_size) override; | 53 bool ResizeNativeWindow(const gfx::Size& viewport_size) override; |
38 bool OnSwapBuffers() override; | 54 bool OnSwapBuffers() override; |
39 void OnSwapBuffersAsync(const SwapCompletionCallback& callback) override; | 55 void OnSwapBuffersAsync(const SwapCompletionCallback& callback) override; |
40 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; | 56 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; |
41 bool IsUniversalDisplayLinkDevice() override; | 57 bool IsUniversalDisplayLinkDevice() override; |
42 | 58 |
43 protected: | 59 protected: |
44 scoped_ptr<DrmWindowProxy> window_; | 60 scoped_ptr<DrmWindowProxy> window_; |
45 | 61 |
46 GbmSurfaceFactory* surface_manager_; | 62 GbmSurfaceFactory* surface_manager_; |
47 | 63 |
48 std::vector<OverlayPlane> planes_; | 64 std::vector<OverlayPlane> planes_; |
| 65 std::vector<OverlayCheck_Params> overlay_params_; |
| 66 |
| 67 base::WeakPtrFactory<GbmSurfaceless> weak_ptr_factory_; |
49 | 68 |
50 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceless); | 69 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceless); |
51 }; | 70 }; |
52 | 71 |
53 } // namespace ui | 72 } // namespace ui |
54 | 73 |
55 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_ | 74 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_ |
OLD | NEW |