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