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_HARDWARE_DISPLAY_PLANE_MANAGER_LEGACY_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_LEGACY_H_
7 
8 #include <stdint.h>
9 #include <memory>
10 
11 #include "base/macros.h"
12 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h"
13 
14 namespace ui {
15 
16 class HardwareDisplayPlaneManagerLegacy : public HardwareDisplayPlaneManager {
17  public:
18   explicit HardwareDisplayPlaneManagerLegacy(DrmDevice* device);
19   ~HardwareDisplayPlaneManagerLegacy() override;
20 
21   // HardwareDisplayPlaneManager:
22   bool Modeset(uint32_t crtc_id,
23                uint32_t framebuffer_id,
24                uint32_t connector_id,
25                const drmModeModeInfo& mode,
26                const HardwareDisplayPlaneList& plane_list) override;
27   bool DisableModeset(uint32_t crtc_id, uint32_t connector) override;
28   bool Commit(HardwareDisplayPlaneList* plane_list,
29               bool should_modeset,
30               scoped_refptr<PageFlipRequest> page_flip_request,
31               std::unique_ptr<gfx::GpuFence>* out_fence) override;
32   bool DisableOverlayPlanes(HardwareDisplayPlaneList* plane_list) override;
33 
34   bool SetColorCorrectionOnAllCrtcPlanes(
35       uint32_t crtc_id,
36       ScopedDrmColorCtmPtr ctm_blob_data) override;
37 
38   bool ValidatePrimarySize(const DrmOverlayPlane& primary,
39                            const drmModeModeInfo& mode) override;
40 
41   void RequestPlanesReadyCallback(
42       DrmOverlayPlaneList planes,
43       base::OnceCallback<void(DrmOverlayPlaneList)> callback) override;
44 
45  protected:
46   bool InitializePlanes() override;
47   bool SetPlaneData(HardwareDisplayPlaneList* plane_list,
48                     HardwareDisplayPlane* hw_plane,
49                     const DrmOverlayPlane& overlay,
50                     uint32_t crtc_id,
51                     const gfx::Rect& src_rect) override;
52   bool IsCompatible(HardwareDisplayPlane* plane,
53                     const DrmOverlayPlane& overlay,
54                     uint32_t crtc_index) const override;
55   bool CommitColorMatrix(const CrtcProperties& crtc_props) override;
56   bool CommitGammaCorrection(const CrtcProperties& crtc_props) override;
57 
58  private:
59   DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerLegacy);
60 };
61 
62 }  // namespace ui
63 
64 #endif  // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_LEGACY_H_
65