| 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_DRM_SURFACE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
| 13 #include "ui/gfx/swap_result.h" | 13 #include "ui/gfx/swap_result.h" |
| 14 #include "ui/ozone/ozone_export.h" | 14 #include "ui/ozone/ozone_export.h" |
| 15 #include "ui/ozone/public/surface_ozone_canvas.h" | 15 #include "ui/ozone/public/surface_ozone_canvas.h" |
| 16 | 16 |
| 17 class SkImage; | 17 class SkImage; |
| 18 class SkSurface; | 18 class SkSurface; |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 | 21 |
| 22 class DrmBuffer; | 22 class DrmBuffer; |
| 23 class DrmWindow; | 23 class DrmWindowProxy; |
| 24 class HardwareDisplayController; | |
| 25 | 24 |
| 26 class OZONE_EXPORT DrmSurface : public SurfaceOzoneCanvas { | 25 class OZONE_EXPORT DrmSurface : public SurfaceOzoneCanvas { |
| 27 public: | 26 public: |
| 28 DrmSurface(DrmWindow* window); | 27 DrmSurface(scoped_ptr<DrmWindowProxy> window); |
| 29 ~DrmSurface() override; | 28 ~DrmSurface() override; |
| 30 | 29 |
| 31 // SurfaceOzoneCanvas: | 30 // SurfaceOzoneCanvas: |
| 32 skia::RefPtr<SkSurface> GetSurface() override; | 31 skia::RefPtr<SkSurface> GetSurface() override; |
| 33 void ResizeCanvas(const gfx::Size& viewport_size) override; | 32 void ResizeCanvas(const gfx::Size& viewport_size) override; |
| 34 void PresentCanvas(const gfx::Rect& damage) override; | 33 void PresentCanvas(const gfx::Rect& damage) override; |
| 35 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; | 34 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 void SchedulePageFlip(); | 37 void SchedulePageFlip(); |
| 39 | 38 |
| 40 // Callback for SchedulePageFlip(). This will signal when the page flip event | 39 // Callback for SchedulePageFlip(). This will signal when the page flip event |
| 41 // has completed. | 40 // has completed. |
| 42 void OnPageFlip(gfx::SwapResult result); | 41 void OnPageFlip(gfx::SwapResult result); |
| 43 | 42 |
| 44 DrmWindow* window_; | 43 scoped_ptr<DrmWindowProxy> window_; |
| 45 | 44 |
| 46 // The actual buffers used for painting. | 45 // The actual buffers used for painting. |
| 47 scoped_refptr<DrmBuffer> front_buffer_; | 46 scoped_refptr<DrmBuffer> front_buffer_; |
| 48 scoped_refptr<DrmBuffer> back_buffer_; | 47 scoped_refptr<DrmBuffer> back_buffer_; |
| 49 | 48 |
| 50 skia::RefPtr<SkSurface> surface_; | 49 skia::RefPtr<SkSurface> surface_; |
| 51 gfx::Rect last_damage_; | 50 gfx::Rect last_damage_; |
| 52 | 51 |
| 53 // Keep track of the requested image and damage for the last presentation. | 52 // Keep track of the requested image and damage for the last presentation. |
| 54 // This will be used to update the scanout buffers once the previous page flip | 53 // This will be used to update the scanout buffers once the previous page flip |
| 55 // events completes. | 54 // events completes. |
| 56 skia::RefPtr<SkImage> pending_image_; | 55 skia::RefPtr<SkImage> pending_image_; |
| 57 gfx::Rect pending_image_damage_; | 56 gfx::Rect pending_image_damage_; |
| 58 bool pending_pageflip_ = false; | 57 bool pending_pageflip_ = false; |
| 59 | 58 |
| 60 base::WeakPtrFactory<DrmSurface> weak_ptr_factory_; | 59 base::WeakPtrFactory<DrmSurface> weak_ptr_factory_; |
| 61 | 60 |
| 62 DISALLOW_COPY_AND_ASSIGN(DrmSurface); | 61 DISALLOW_COPY_AND_ASSIGN(DrmSurface); |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 } // namespace ui | 64 } // namespace ui |
| 66 | 65 |
| 67 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_ | 66 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_ |
| OLD | NEW |