1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <hardware/hwcomposer2.h> 20 21 #include "drm/DrmHwc.h" 22 23 namespace android { 24 25 class DrmHwcTwo : public DrmHwc { 26 public: 27 DrmHwcTwo() = default; 28 ~DrmHwcTwo() override = default; 29 30 HWC2::Error RegisterCallback(int32_t descriptor, hwc2_callback_data_t data, 31 hwc2_function_pointer_t function); 32 33 // DrmHwc 34 void SendVsyncEventToClient(hwc2_display_t displayid, int64_t timestamp, 35 uint32_t vsync_period) const override; 36 void SendVsyncPeriodTimingChangedEventToClient( 37 hwc2_display_t displayid, int64_t timestamp) const override; 38 void SendRefreshEventToClient(uint64_t displayid) override; 39 void SendHotplugEventToClient(hwc2_display_t displayid, 40 DisplayStatus display_status) override; 41 42 private: 43 std::pair<HWC2_PFN_HOTPLUG, hwc2_callback_data_t> hotplug_callback_{}; 44 std::pair<HWC2_PFN_VSYNC, hwc2_callback_data_t> vsync_callback_{}; 45 #if __ANDROID_API__ > 29 46 std::pair<HWC2_PFN_VSYNC_2_4, hwc2_callback_data_t> vsync_2_4_callback_{}; 47 std::pair<HWC2_PFN_VSYNC_PERIOD_TIMING_CHANGED, hwc2_callback_data_t> 48 period_timing_changed_callback_{}; 49 #endif 50 std::pair<HWC2_PFN_REFRESH, hwc2_callback_data_t> refresh_callback_{}; 51 }; 52 } // namespace android 53